aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Handlers/MiscHandler.cpp
diff options
context:
space:
mode:
authorRochet2 <tqbattlenet@gmail.com>2014-03-13 20:27:11 +0100
committerShauren <shauren.trinity@gmail.com>2014-03-13 20:27:11 +0100
commit6c64fa8de36dad958821c6078b3f2f5f5753a2fc (patch)
treefdaa183506b76ceed7620ea696993ab241deb720 /src/server/game/Handlers/MiscHandler.cpp
parent78398ed5ceb6fb8d9186403e5e90b14a5c5d40c3 (diff)
Core/Gossip: Add security to C++ scripted gossip options by checking guid of the object that the player is interecting with. Idea by @LilleCarl
Closes #11567
Diffstat (limited to 'src/server/game/Handlers/MiscHandler.cpp')
-rw-r--r--src/server/game/Handlers/MiscHandler.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/server/game/Handlers/MiscHandler.cpp b/src/server/game/Handlers/MiscHandler.cpp
index 60f4fb09c28..d181c64f199 100644
--- a/src/server/game/Handlers/MiscHandler.cpp
+++ b/src/server/game/Handlers/MiscHandler.cpp
@@ -97,9 +97,19 @@ void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket& recvData)
recvData >> guid >> menuId >> gossipListId;
+ if (!_player->PlayerTalkClass->GetGossipMenu().GetItem(gossipListId))
+ {
+ recvData.rfinish();
+ return;
+ }
+
if (_player->PlayerTalkClass->IsGossipOptionCoded(gossipListId))
recvData >> code;
+ // Prevent cheating on C++ scripted menus
+ if (_player->PlayerTalkClass->GetGossipMenu().GetSenderGUID() != guid)
+ return;
+
Creature* unit = NULL;
GameObject* go = NULL;
if (IS_CRE_OR_VEH_GUID(guid))
@@ -151,7 +161,8 @@ void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket& recvData)
else
{
go->AI()->GossipSelectCode(_player, menuId, gossipListId, code.c_str());
- sScriptMgr->OnGossipSelectCode(_player, go, _player->PlayerTalkClass->GetGossipOptionSender(gossipListId), _player->PlayerTalkClass->GetGossipOptionAction(gossipListId), code.c_str());
+ if (!sScriptMgr->OnGossipSelectCode(_player, go, _player->PlayerTalkClass->GetGossipOptionSender(gossipListId), _player->PlayerTalkClass->GetGossipOptionAction(gossipListId), code.c_str()))
+ _player->OnGossipSelect(unit, gossipListId, menuId);
}
}
else