mirror of
https://github.com/liyunfan1223/azerothcore-wotlk.git
synced 2026-08-08 07:48:02 +00:00
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:
@@ -97,7 +97,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recvData)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sender->HasAura(1852) && type != CHAT_MSG_WHISPER)
|
if (sender->HasAura(1852) && type != CHAT_MSG_WHISPER)
|
||||||
{
|
{
|
||||||
SendNotification(GetAcoreString(LANG_GM_SILENCE), sender->GetName().c_str());
|
SendNotification(GetAcoreString(LANG_GM_SILENCE), sender->GetName().c_str());
|
||||||
@@ -113,7 +113,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recvData)
|
|||||||
recvData.rfinish();
|
recvData.rfinish();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (langDesc->skill_id != 0 && !sender->HasSkill(langDesc->skill_id))
|
if (langDesc->skill_id != 0 && !sender->HasSkill(langDesc->skill_id))
|
||||||
{
|
{
|
||||||
// also check SPELL_AURA_COMPREHEND_LANGUAGE (client offers option to speak in that language)
|
// also check SPELL_AURA_COMPREHEND_LANGUAGE (client offers option to speak in that language)
|
||||||
@@ -185,7 +185,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recvData)
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
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());
|
GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow());
|
||||||
|
|
||||||
recvData.rfinish();
|
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);
|
sScriptMgr->OnBeforeSendChatMessage(_player, type, lang, msg);
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
|
|||||||
Reference in New Issue
Block a user