Fix client game crash with invite player to invalid name for Channel. (#2087)

* Fix client game crash with invite player to invalid name for Channel.

7b8f294c02

https://github.com/TrinityCore/TrinityCore/issues/23215

* Change `#include <utf8.h>` to `#include "utf8.h"`
This commit is contained in:
Amin.MasterkinG
2019-07-26 17:55:10 +04:30
committed by Poszer
parent 7d44bf25c7
commit 502d8fc14b

View File

@@ -9,6 +9,7 @@
#include "Player.h"
#include <cctype>
#include "utf8.h"
void WorldSession::HandleJoinChannel(WorldPacket& recvPacket)
{
@@ -40,7 +41,7 @@ void WorldSession::HandleJoinChannel(WorldPacket& recvPacket)
// pussywizard: restrict allowed characters in channel name to avoid |0 and possibly other exploits
//if (!ObjectMgr::IsValidChannelName(channelName))
if (channelName.find("|") != std::string::npos || channelName.size() >= 100)
if (channelName.find("|") != std::string::npos || channelName.size() >= 100 || !utf8::is_valid(channelName.begin(), channelName.end()))
return;
if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeamId()))