Core/PacketIO: Validate utf8 in every client packet

(cherry picked from commit 0a2a96efaa)
This commit is contained in:
Shauren
2020-03-15 14:28:29 +01:00
parent bf81c39bbd
commit 09967ad7fd
5 changed files with 57 additions and 45 deletions

View File

@@ -41,7 +41,6 @@
#include "Util.h"
#include "World.h"
#include "WorldPacket.h"
#include <utf8.h>
#include <algorithm>
inline bool isNasty(uint8 c)
@@ -73,14 +72,6 @@ inline bool ValidateMessage(Player const* player, std::string& msg)
}
}
// validate utf8
if (!utf8::is_valid(msg.begin(), msg.end()))
{
TC_LOG_ERROR("network", "Player %s (%s) sent a message containing an invalid UTF8 sequence - blocked", player->GetName().c_str(),
player->GetGUID().ToString().c_str());
return false;
}
// collapse multiple spaces into one
if (sWorld->getBoolConfig(CONFIG_CHAT_FAKE_MESSAGE_PREVENTING))
{