aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2013-05-07 18:47:36 +0200
committerShauren <shauren.trinity@gmail.com>2013-05-07 18:47:36 +0200
commit27ceee92fbfdb0021b9e6e852d5097b7195e9e11 (patch)
tree3bcfd5d5c21b3633bf984a1a818fba67a382269d
parent45bae8d4b74d772215cb22c7bb27732f55c5d9fd (diff)
Core/AuctionHouse: Fixed field type mismatches when saving auction to database (db fields are unsigned int) and prevent posting auctions with bids or buyouts over gold cap
Closes #9762
-rw-r--r--src/server/game/AuctionHouse/AuctionHouseMgr.cpp8
-rw-r--r--src/server/game/Handlers/AuctionHouseHandler.cpp14
2 files changed, 17 insertions, 5 deletions
diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
index 94964568695..a29f9414fa9 100644
--- a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
+++ b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
@@ -657,12 +657,12 @@ void AuctionEntry::SaveToDB(SQLTransaction& trans) const
stmt->setUInt32(1, auctioneer);
stmt->setUInt32(2, itemGUIDLow);
stmt->setUInt32(3, owner);
- stmt->setInt32 (4, int32(buyout));
+ stmt->setUInt32(4, buyout);
stmt->setUInt32(5, uint32(expire_time));
stmt->setUInt32(6, bidder);
- stmt->setInt32 (7, int32(bid));
- stmt->setInt32 (8, int32(startbid));
- stmt->setInt32 (9, int32(deposit));
+ stmt->setUInt32(7, bid);
+ stmt->setUInt32(8, startbid);
+ stmt->setUInt32(9, deposit);
trans->Append(stmt);
}
diff --git a/src/server/game/Handlers/AuctionHouseHandler.cpp b/src/server/game/Handlers/AuctionHouseHandler.cpp
index 47ad7ffa568..abeee3e1a9e 100644
--- a/src/server/game/Handlers/AuctionHouseHandler.cpp
+++ b/src/server/game/Handlers/AuctionHouseHandler.cpp
@@ -127,6 +127,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData)
if (itemsCount > MAX_AUCTION_ITEMS)
{
SendAuctionCommandResult(0, AUCTION_SELL_ITEM, ERR_AUCTION_DATABASE_ERROR);
+ recvData.rfinish();
return;
}
@@ -135,8 +136,11 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData)
recvData >> itemGUIDs[i];
recvData >> count[i];
- if (!itemGUIDs[i] || !count[i] || count[i] > 1000 )
+ if (!itemGUIDs[i] || !count[i] || count[i] > 1000)
+ {
+ recvData.rfinish();
return;
+ }
}
recvData >> bid;
@@ -146,6 +150,14 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData)
if (!bid || !etime)
return;
+ if (bid > MAX_MONEY_AMOUNT || buyout > MAX_MONEY_AMOUNT)
+ {
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleAuctionSellItem - Player %s (GUID %u) attempted to sell item with higher price than max gold amount.", _player->GetName().c_str(), _player->GetGUIDLow());
+ SendAuctionCommandResult(0, AUCTION_SELL_ITEM, ERR_AUCTION_DATABASE_ERROR);
+ return;
+ }
+
+
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(auctioneer, UNIT_NPC_FLAG_AUCTIONEER);
if (!creature)
{