aboutsummaryrefslogtreecommitdiff
path: root/src/game/ItemHandler.cpp
diff options
context:
space:
mode:
authormegamage <none@none>2009-04-13 17:21:59 -0500
committermegamage <none@none>2009-04-13 17:21:59 -0500
commit214307428078f937c068fb5219686e3090c97a9c (patch)
tree2febd9b6cf0a978b6cfda1bd14eb5bc6de9a1dd2 /src/game/ItemHandler.cpp
parent53d37935a98bfb767b65c508bc53908817eaba24 (diff)
[7659] Added several security checks to prevent cheating using facked packets Author: arrai
--HG-- branch : trunk
Diffstat (limited to 'src/game/ItemHandler.cpp')
-rw-r--r--src/game/ItemHandler.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/game/ItemHandler.cpp b/src/game/ItemHandler.cpp
index 27aa29267df..aef5ea829c6 100644
--- a/src/game/ItemHandler.cpp
+++ b/src/game/ItemHandler.cpp
@@ -827,10 +827,23 @@ void WorldSession::HandleAutoStoreBagItemOpcode( WorldPacket & recv_data )
_player->StoreItem( dest, pItem, true );
}
-void WorldSession::HandleBuyBankSlotOpcode(WorldPacket& /*recvPacket*/)
+void WorldSession::HandleBuyBankSlotOpcode(WorldPacket& recvPacket)
{
+ CHECK_PACKET_SIZE(recvPacket, 8);
+
sLog.outDebug("WORLD: CMSG_BUY_BANK_SLOT");
+ uint64 guid;
+ recvPacket >> guid;
+
+ // cheating protection
+ Creature *pCreature = ObjectAccessor::GetNPCIfCanInteractWith(*_player, guid, UNIT_NPC_FLAG_BANKER);
+ if(!pCreature)
+ {
+ sLog.outDebug( "WORLD: HandleBuyBankSlotOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)) );
+ return;
+ }
+
uint32 slot = _player->GetByteValue(PLAYER_BYTES_2, 2);
// next slot