diff options
| author | leak <leak@bitmx.net> | 2012-11-01 20:04:35 +0100 |
|---|---|---|
| committer | leak <leak@bitmx.net> | 2012-11-01 20:04:35 +0100 |
| commit | 6bf9cb56a9ef5c37b3216018e960a5c49e0d1007 (patch) | |
| tree | a06a706c74e90d2a6c72d3ebbf444c1c8bdf25dc /src/server/game/Chat | |
| parent | 76bdeb5c44fbe7790f75cd5e83a68ffef9ab123b (diff) | |
Core/Chat: Prevent client crashes with invalid chat language and message type combinations
Fixes #8083
Diffstat (limited to 'src/server/game/Chat')
| -rwxr-xr-x | src/server/game/Chat/Chat.cpp | 14 | ||||
| -rwxr-xr-x | src/server/game/Chat/Chat.h | 2 |
2 files changed, 8 insertions, 8 deletions
diff --git a/src/server/game/Chat/Chat.cpp b/src/server/game/Chat/Chat.cpp index 88c3de274fb..7faf05a577c 100755 --- a/src/server/game/Chat/Chat.cpp +++ b/src/server/game/Chat/Chat.cpp @@ -425,7 +425,7 @@ bool ChatHandler::SetDataForCommandInTable(ChatCommand* table, char const* text, return false; } -int ChatHandler::ParseCommands(char const* text) +bool ChatHandler::ParseCommands(char const* text) { ASSERT(text); ASSERT(*text); @@ -433,23 +433,23 @@ int ChatHandler::ParseCommands(char const* text) std::string fullcmd = text; if (m_session && AccountMgr::IsPlayerAccount(m_session->GetSecurity()) && !sWorld->getBoolConfig(CONFIG_ALLOW_PLAYER_COMMANDS)) - return 0; + return false; /// chat case (.command or !command format) if (m_session) { if (text[0] != '!' && text[0] != '.') - return 0; + return false; } /// ignore single . and ! in line if (strlen(text) < 2) - return 0; + return false; // original `text` can't be used. It content destroyed in command code processing. /// ignore messages staring from many dots. if ((text[0] == '.' && text[1] == '.') || (text[0] == '!' && text[1] == '!')) - return 0; + return false; /// skip first . or ! (in console allowed use command with . and ! and without its) if (text[0] == '!' || text[0] == '.') @@ -458,11 +458,11 @@ int ChatHandler::ParseCommands(char const* text) if (!ExecuteCommandInTable(getCommandTable(), text, fullcmd)) { if (m_session && AccountMgr::IsPlayerAccount(m_session->GetSecurity())) - return 0; + return false; SendSysMessage(LANG_NO_CMD); } - return 1; + return true; } bool ChatHandler::isValidChatMessage(char const* message) diff --git a/src/server/game/Chat/Chat.h b/src/server/game/Chat/Chat.h index d07f036f780..0c1b22182e1 100755 --- a/src/server/game/Chat/Chat.h +++ b/src/server/game/Chat/Chat.h @@ -74,7 +74,7 @@ class ChatHandler void PSendSysMessage(int32 entry, ...); std::string PGetParseString(int32 entry, ...) const; - int ParseCommands(const char* text); + bool ParseCommands(const char* text); static ChatCommand* getCommandTable(); |
