Core/Channels: Limit channel length to 31 characters

This commit is contained in:
jackpoz
2020-03-15 16:07:40 +01:00
parent 639ac9692f
commit 2707877cf6

View File

@@ -25,6 +25,7 @@
#include <cctype>
static size_t const MAX_CHANNEL_PASS_STR = 31;
static size_t const MAX_CHANNEL_NAME_STR = 31;
void WorldSession::HandleJoinChannel(WorldPacket& recvPacket)
{
@@ -56,6 +57,18 @@ void WorldSession::HandleJoinChannel(WorldPacket& recvPacket)
return;
}
if (channelName.length() > MAX_CHANNEL_NAME_STR)
{
TC_LOG_ERROR("network", "Player %s tried to create a channel with a name more than " SZFMTD " characters long - blocked", GetPlayer()->GetGUID().ToString().c_str(), MAX_CHANNEL_NAME_STR);
return;
}
if (password.length() > MAX_CHANNEL_PASS_STR)
{
TC_LOG_ERROR("network", "Player %s tried to create a channel with a password more that " SZFMTD " characters long - blocked", GetPlayer()->GetGUID().ToString().c_str(), MAX_CHANNEL_PASS_STR);
return;
}
if (!ValidateHyperlinksAndMaybeKick(channelName))
return;