diff options
author | jackpoz <giacomopoz@gmail.com> | 2020-03-15 16:07:40 +0100 |
---|---|---|
committer | jackpoz <giacomopoz@gmail.com> | 2020-03-15 16:07:40 +0100 |
commit | 2707877cf6ab34727c348190ca15499ef0205b1c (patch) | |
tree | 5222a68eaf0826ccfcdfc0453fbd21a5535ec068 | |
parent | 639ac9692f99afcc4588021508c7ee0a08c62f9f (diff) |
Core/Channels: Limit channel length to 31 characters
-rw-r--r-- | src/server/game/Handlers/ChannelHandler.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/server/game/Handlers/ChannelHandler.cpp b/src/server/game/Handlers/ChannelHandler.cpp index 832429dc222..bde4757c513 100644 --- a/src/server/game/Handlers/ChannelHandler.cpp +++ b/src/server/game/Handlers/ChannelHandler.cpp @@ -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; |