mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-22 02:04:52 +01:00
Scripts/Commands: Fix crash in ".kick" command
Fix a NULL dereference exception happening when using .kick command caused by a strtok(NULL) call without a previous call to the string to be tokenized.
Issue added in 101cad1f28
This commit is contained in:
@@ -809,10 +809,13 @@ public:
|
||||
if (handler->HasLowerSecurity(target, 0))
|
||||
return false;
|
||||
|
||||
char const* kickReason = strtok(NULL, "\r");
|
||||
std::string kickReasonStr = "No reason";
|
||||
if (kickReason != NULL)
|
||||
kickReasonStr = kickReason;
|
||||
if (*args != '\0')
|
||||
{
|
||||
char const* kickReason = strtok(NULL, "\r");
|
||||
if (kickReason != NULL)
|
||||
kickReasonStr = kickReason;
|
||||
}
|
||||
|
||||
if (sWorld->getBoolConfig(CONFIG_SHOW_KICK_IN_WORLD))
|
||||
sWorld->SendWorldText(LANG_COMMAND_KICKMESSAGE_WORLD, (handler->GetSession() ? handler->GetSession()->GetPlayerName().c_str() : "Server"), playerName.c_str(), kickReasonStr.c_str());
|
||||
|
||||
Reference in New Issue
Block a user