mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-02-10 20:19:49 +01:00
Core/Channel: Sanitize channel names
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user