Core/Channel: Sanitize channel names

This commit is contained in:
jackpoz
2019-05-29 23:02:40 +02:00
parent f0bd90cc35
commit 7b8f294c02

View File

@@ -24,6 +24,7 @@
#include "ObjectMgr.h" // for normalizePlayerName
#include "Player.h"
#include <cctype>
#include <utf8.h>
static size_t const MAX_CHANNEL_PASS_STR = 31;
@@ -57,6 +58,15 @@ void WorldSession::HandleJoinChannel(WorldPacket& recvPacket)
return;
}
if (!utf8::is_valid(channelName.begin(), 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(channelName))
return;
if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam()))
if (Channel* channel = cMgr->GetJoinChannel(channelId, channelName, zone))
channel->JoinChannel(GetPlayer(), password);