* Fix a crash in Player::BuyItemFromVendor caused by player spoofing packets (Backported from TC2)
* Another crash exploit prevention using the same method in Bag::StoreItem, by Visagalis --HG-- branch : trunk
This commit is contained in:
+5
-1
@@ -151,7 +151,11 @@ void Bag::RemoveItem( uint8 slot, bool /*update*/ )
|
||||
|
||||
void Bag::StoreItem( uint8 slot, Item *pItem, bool /*update*/ )
|
||||
{
|
||||
assert(slot < MAX_BAG_SIZE);
|
||||
if(slot > MAX_BAG_SIZE)
|
||||
{
|
||||
sLog.outError("Player GUID" UI64FMTD "tried to manipulate packets and crash the server.", GetOwnerGUID());
|
||||
return;
|
||||
}
|
||||
|
||||
if( pItem )
|
||||
{
|
||||
|
||||
@@ -17131,6 +17131,10 @@ bool Player::BuyItemFromVendor(uint64 vendorguid, uint32 item, uint8 count, uint
|
||||
{
|
||||
// cheating attempt
|
||||
if(count < 1) count = 1;
|
||||
|
||||
// cheating attempt
|
||||
if(slot > MAX_BAG_SIZE)
|
||||
return false;
|
||||
|
||||
if(!isAlive())
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user