Jump to content
  • Sending "special" message which crashes server


    AlienCZ
    • Main Category: Core / Mangos Daemon
      Sub-Category: Core Crash
      Version: 22.x (Current Master Branch)
      Related to:
     Share

    Sending this into chat or using as macro crashes server.

    /run SendChatMessage("WOW", "WHISPER", nil, "\240\146\140\165\240\146\145\163\240\146\145\169\240\147\139\141\240\147\139\136\240\147\137\161\240\146\140\165\240\146\145\163\240\146\145\169\240\147\139\141\240\147\139\136\240\147\137\161")

    Temporary fix:
    src/shared/Utilities/Util.cpp
    Line 330 , change to

    Spoiler

    bool Utf8toWStr(char const* utf8str, size_t csize, wchar_t* wstr, size_t& wsize)
    {
        try
        {
            size_t len = utf8::distance(utf8str, utf8str + csize);
            if (len > wsize)
            {
                if (wsize > 0)
                {
                    wstr[0] = L'\0';
                }
                wsize = 0;
                return false;
            }

            wsize = len;
            utf8::utf8to16(utf8str, utf8str + csize, wstr);
            wstr[len] = L'\0';
        }
        catch (std::exception)
        {
            wchar_t const* errorMessage = L"An error occurred converting string from UTF-8 to WStr";
            size_t errorMessageLength = wcslen(errorMessage);
            if (wsize >= errorMessageLength)
            {
                wcscpy(wstr, errorMessage);
                wsize = wcslen(wstr);
            }
            else if (wsize > 0)
            {
                    wstr[0] = L'\0';
                wsize = 0;
            }
            else
                wsize = 0;

            return false;
        }

        return true;
    }

     

     Share


    User Feedback

    Recommended Comments

    There are no comments to display.



    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use