mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Core/Channels: Limit channel length to 31 characters
(cherry picked from commit 2707877cf6)
This commit is contained in:
@@ -357,7 +357,7 @@ CREATE TABLE `channels` (
|
||||
`team` int(10) unsigned NOT NULL,
|
||||
`announce` tinyint(3) unsigned NOT NULL DEFAULT '1',
|
||||
`ownership` tinyint(3) unsigned NOT NULL DEFAULT '1',
|
||||
`password` varchar(32) DEFAULT NULL,
|
||||
`password` varchar(128) DEFAULT NULL,
|
||||
`bannedList` text,
|
||||
`lastUsed` bigint(20) unsigned NOT NULL,
|
||||
PRIMARY KEY (`name`,`team`)
|
||||
@@ -3651,7 +3651,8 @@ INSERT INTO `updates` VALUES
|
||||
('2021_11_04_00_characters.sql','ED533235ADAD174F91A6B8E51D1046243B78B46D','ARCHIVED','2021-11-04 21:53:04',0),
|
||||
('2021_11_17_00_characters.sql','03A0AB8ECD8BE5D818D41A8A610097C94A9C7DB9','ARCHIVED','2021-11-17 13:23:17',0),
|
||||
('2021_12_16_00_characters_2019_07_14_00_characters.sql','DC1A3D3311FCF9106B4D91F8D2C5B893AD66C093','RELEASED','2021-12-16 01:06:53',0),
|
||||
('2021_12_16_01_characters_2019_07_16_00_characters.sql','76AE193EFA3129FA1702BF7B6FA7C4127B543BDF','RELEASED','2021-12-16 20:16:25',0);
|
||||
('2021_12_16_01_characters_2019_07_16_00_characters.sql','76AE193EFA3129FA1702BF7B6FA7C4127B543BDF','RELEASED','2021-12-16 20:16:25',0),
|
||||
('2021_12_23_00_characters.sql','7F2BD7CA61CD28D74AD9CA9F06FD7E542837ED3F','RELEASED','2021-12-23 19:16:29',0);
|
||||
/*!40000 ALTER TABLE `updates` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
ALTER TABLE `channels` MODIFY `password` varchar(128) DEFAULT NULL AFTER `ownership`;
|
||||
@@ -25,8 +25,8 @@
|
||||
#include "Player.h"
|
||||
#include <cctype>
|
||||
|
||||
static size_t const MAX_CHANNEL_NAME_STR = 0x31;
|
||||
static size_t const MAX_CHANNEL_PASS_STR = 31;
|
||||
static size_t const MAX_CHANNEL_NAME_STR = 31;
|
||||
static size_t const MAX_CHANNEL_PASS_STR = 127;
|
||||
|
||||
void WorldSession::HandleJoinChannel(WorldPackets::Channel::JoinChannel& packet)
|
||||
{
|
||||
@@ -44,8 +44,30 @@ void WorldSession::HandleJoinChannel(WorldPackets::Channel::JoinChannel& packet)
|
||||
return;
|
||||
}
|
||||
|
||||
if (packet.ChannelName.empty())
|
||||
if (packet.ChannelName.empty() || isdigit((unsigned char)packet.ChannelName[0]))
|
||||
{
|
||||
WorldPackets::Channel::ChannelNotify channelNotify;
|
||||
channelNotify.Type = CHAT_INVALID_NAME_NOTICE;
|
||||
channelNotify._Channel = packet.ChannelName;
|
||||
SendPacket(channelNotify.Write());
|
||||
return;
|
||||
}
|
||||
|
||||
if (packet.ChannelName.length() > MAX_CHANNEL_NAME_STR)
|
||||
{
|
||||
WorldPackets::Channel::ChannelNotify channelNotify;
|
||||
channelNotify.Type = CHAT_INVALID_NAME_NOTICE;
|
||||
channelNotify._Channel = packet.ChannelName;
|
||||
SendPacket(channelNotify.Write());
|
||||
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 (packet.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(packet.ChannelName))
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user