aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Chat/Chat.cpp
diff options
context:
space:
mode:
authorleak <leak@bitmx.net>2012-11-01 20:04:35 +0100
committerleak <leak@bitmx.net>2012-11-01 20:04:35 +0100
commit6bf9cb56a9ef5c37b3216018e960a5c49e0d1007 (patch)
treea06a706c74e90d2a6c72d3ebbf444c1c8bdf25dc /src/server/game/Chat/Chat.cpp
parent76bdeb5c44fbe7790f75cd5e83a68ffef9ab123b (diff)
Core/Chat: Prevent client crashes with invalid chat language and message type combinations
Fixes #8083
Diffstat (limited to 'src/server/game/Chat/Chat.cpp')
-rwxr-xr-xsrc/server/game/Chat/Chat.cpp14
1 files changed, 7 insertions, 7 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)