From 242917e461ab5c59559fafdb89e4f089cf9e7abf 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 --- 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 b1aeccd22e..bd33b6f461 100644 --- a/src/server/game/Handlers/GroupHandler.cpp +++ b/src/server/game/Handlers/GroupHandler.cpp @@ -114,6 +114,13 @@ void WorldSession::HandleGroupInviteOpcode(WorldPacket& recvData) return; } + // player trying to invite himself (most likely cheating) + if (player == GetPlayer()) + { + SendPartyResult(PARTY_OP_INVITE, membername, ERR_BAD_PLAYER_NAME_S); + return; + } + // restrict invite to GMs if (!sWorld->getBoolConfig(CONFIG_ALLOW_GM_GROUP) && !GetPlayer()->IsGameMaster() && player->IsGameMaster()) { @@ -256,6 +263,7 @@ void WorldSession::HandleGroupInviteOpcode(WorldPacket& recvData) } if (!group->AddInvite(player)) { + group->RemoveAllInvites(); delete group; return; }