fix(core/packet): prevent client crash from malformed packet/message (#2910)

* Update AuctionHouseHandler.cpp

* fix(core/packet): prevent crash from malformed string
This commit is contained in:
Stefano Borzì
2020-04-21 00:00:26 +02:00
committed by GitHub
parent 1603646aad
commit ad6985f459

View File

@@ -97,7 +97,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recvData)
return;
}
}
if (sender->HasAura(1852) && type != CHAT_MSG_WHISPER)
{
SendNotification(GetAcoreString(LANG_GM_SILENCE), sender->GetName().c_str());
@@ -113,7 +113,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recvData)
recvData.rfinish();
return;
}
if (langDesc->skill_id != 0 && !sender->HasSkill(langDesc->skill_id))
{
// also check SPELL_AURA_COMPREHEND_LANGUAGE (client offers option to speak in that language)
@@ -185,7 +185,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recvData)
break;
default:
sLog->outError("Player %s (GUID: %u) sent a chatmessage with an invalid language/message type combination",
sLog->outError("Player %s (GUID: %u) sent a chatmessage with an invalid language/message type combination",
GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow());
recvData.rfinish();
@@ -329,6 +329,11 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recvData)
}
}
// prevent crash player
if (msg.find("| |Hquest") != std::string::npos) {
return;
}
sScriptMgr->OnBeforeSendChatMessage(_player, type, lang, msg);
switch (type)