aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkrz <none@none>2009-06-26 20:58:39 +0200
committerkrz <none@none>2009-06-26 20:58:39 +0200
commit10ac2b73b88d84bd3005da69b145255a9f3aa2b9 (patch)
tree58dc1b844f9f4634218f841873bf544a2a016c32
parenta494b0436c5bdcbcff4d89c7bdd63060fd09133b (diff)
Better check to prevent exploiting in BuyItemFromVendor
--HG-- branch : trunk
-rw-r--r--src/game/Player.cpp15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index 54e35a28466..4c651ca8e89 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -17145,15 +17145,6 @@ bool Player::BuyItemFromVendor(uint64 vendorguid, uint32 item, uint8 count, uint
SendBuyError( BUY_ERR_CANT_FIND_ITEM, NULL, item, 0);
return false;
}
- else
- {
- if(slot > pProto->ContainerSlots)
- {
- sLog.outDebug("CHEATING ATTEMPT slot > pProto->ContainerSlots in BuyItemFromVendor playerGUID: "I64FMT" name: %s slot: %u", GetGUID(), GetName(), slot);
- return false;
- }
- }
-
Creature *pCreature = ObjectAccessor::GetNPCIfCanInteractWith(*this, vendorguid,UNIT_NPC_FLAG_VENDOR);
if (!pCreature)
@@ -17266,6 +17257,12 @@ bool Player::BuyItemFromVendor(uint64 vendorguid, uint32 item, uint8 count, uint
{
if( bagguid == pBag->GetGUID() )
{
+ // slot is counted from 0 but BagSize from 1
+ if(slot+1 > pBag->GetBagSize())
+ {
+ sLog.outDebug("CHEATING ATTEMPT slot > bagSize in BuyItemFromVendor playerGUID: "I64FMT" name: %s slot: %u", GetGUID(), GetName(), slot);
+ return false;
+ }
bag = i;
break;
}