From fe3a057ba5037db4a5692f1fdd8416940d1274d8 Mon Sep 17 00:00:00 2001 From: jackpoz Date: Mon, 1 Aug 2016 18:55:47 +0200 Subject: [PATCH] Core/Group: Do not allow a player to invite himself Do not allow a player to invite himself in group. Fix an edge case when inviting another player that would cause a crash. Fix #17664 (cherry picked from commit bcfa47c0514b51690a5dd222b3b1ac5f20379232) --- src/server/game/Handlers/GroupHandler.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/server/game/Handlers/GroupHandler.cpp b/src/server/game/Handlers/GroupHandler.cpp index 6cc162eff8974..cf803ed2d885f 100644 --- a/src/server/game/Handlers/GroupHandler.cpp +++ b/src/server/game/Handlers/GroupHandler.cpp @@ -69,6 +69,13 @@ void WorldSession::HandlePartyInviteOpcode(WorldPackets::Party::PartyInviteClien return; } + // player trying to invite himself (most likely cheating) + if (player == GetPlayer()) + { + SendPartyResult(PARTY_OP_INVITE, player->GetName(), ERR_BAD_PLAYER_NAME_S); + return; + } + // restrict invite to GMs if (!sWorld->getBoolConfig(CONFIG_ALLOW_GM_GROUP) && !GetPlayer()->IsGameMaster() && player->IsGameMaster()) { @@ -160,6 +167,7 @@ void WorldSession::HandlePartyInviteOpcode(WorldPackets::Party::PartyInviteClien } if (!group->AddInvite(player)) { + group->RemoveAllInvites(); delete group; return; }