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

@@ -24,7 +24,6 @@
#include "ObjectMgr.h" // for normalizePlayerName
#include "Player.h"
#include <cctype>
#include <utf8.h>
static size_t const MAX_CHANNEL_NAME_STR = 0x31;
static size_t const MAX_CHANNEL_PASS_STR = 31;
@@ -48,12 +47,6 @@ void WorldSession::HandleJoinChannel(WorldPackets::Channel::JoinChannel& packet)
if (packet.ChannelName.empty())
return;
if (!utf8::is_valid(packet.ChannelName.begin(), packet.ChannelName.end()))
{
TC_LOG_ERROR("network", "Player %s tried to create a channel with an invalid UTF8 sequence - blocked", GetPlayer()->GetGUID().ToString().c_str());
return;
}
if (!ValidateHyperlinksAndMaybeKick(packet.ChannelName))
return;