refactor(HandleAuctionListOwnerItems): prevent crash (#2684)
This commit is contained in:
@@ -218,7 +218,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recvData)
|
|||||||
SendAuctionCommandResult(0, AUCTION_SELL_ITEM, ERR_AUCTION_DATABASE_ERROR);
|
SendAuctionCommandResult(0, AUCTION_SELL_ITEM, ERR_AUCTION_DATABASE_ERROR);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if there are 2 identical guids, in this case user is most likely cheating
|
// check if there are 2 identical guids, in this case user is most likely cheating
|
||||||
for (uint32 i = 0; i < itemsCount - 1; ++i)
|
for (uint32 i = 0; i < itemsCount - 1; ++i)
|
||||||
{
|
{
|
||||||
@@ -646,6 +646,13 @@ void WorldSession::HandleAuctionListBidderItems(WorldPacket & recvData)
|
|||||||
//this void sends player info about his auctions
|
//this void sends player info about his auctions
|
||||||
void WorldSession::HandleAuctionListOwnerItems(WorldPacket & recvData)
|
void WorldSession::HandleAuctionListOwnerItems(WorldPacket & recvData)
|
||||||
{
|
{
|
||||||
|
// prevent crash caused by malformed packet
|
||||||
|
uint64 guid;
|
||||||
|
uint32 listfrom;
|
||||||
|
|
||||||
|
recvData >> guid;
|
||||||
|
recvData >> listfrom;
|
||||||
|
|
||||||
// pussywizard:
|
// pussywizard:
|
||||||
const uint32 delay = 4500;
|
const uint32 delay = 4500;
|
||||||
const uint32 now = World::GetGameTimeMS();
|
const uint32 now = World::GetGameTimeMS();
|
||||||
@@ -656,10 +663,11 @@ void WorldSession::HandleAuctionListOwnerItems(WorldPacket & recvData)
|
|||||||
diff = delay;
|
diff = delay;
|
||||||
|
|
||||||
_lastAuctionListOwnerItemsMSTime = now + delay; // set longest possible here, actual exectuing will change this to getMSTime of that moment
|
_lastAuctionListOwnerItemsMSTime = now + delay; // set longest possible here, actual exectuing will change this to getMSTime of that moment
|
||||||
_player->m_Events.AddEvent(new AuctionListOwnerItemsDelayEvent(recvData, _player->GetGUID(), true), _player->m_Events.CalculateTime(delay-diff));
|
_player->m_Events.AddEvent(new AuctionListOwnerItemsDelayEvent(guid, _player->GetGUID(), true), _player->m_Events.CalculateTime(delay-diff));
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleAuctionListOwnerItemsEvent(WorldPacket & recvData)
|
|
||||||
|
void WorldSession::HandleAuctionListOwnerItemsEvent(uint64 creatureGuid)
|
||||||
{
|
{
|
||||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_AUCTION_LIST_OWNER_ITEMS");
|
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_AUCTION_LIST_OWNER_ITEMS");
|
||||||
@@ -667,13 +675,7 @@ void WorldSession::HandleAuctionListOwnerItemsEvent(WorldPacket & recvData)
|
|||||||
|
|
||||||
_lastAuctionListOwnerItemsMSTime = World::GetGameTimeMS(); // pussywizard
|
_lastAuctionListOwnerItemsMSTime = World::GetGameTimeMS(); // pussywizard
|
||||||
|
|
||||||
uint32 listfrom;
|
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(creatureGuid, UNIT_NPC_FLAG_AUCTIONEER);
|
||||||
uint64 guid;
|
|
||||||
|
|
||||||
recvData >> guid;
|
|
||||||
recvData >> listfrom; // not used in fact (this list not have page control in client)
|
|
||||||
|
|
||||||
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_AUCTIONEER);
|
|
||||||
if (!creature)
|
if (!creature)
|
||||||
{
|
{
|
||||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ ACE_Thread_Mutex AsyncAuctionListingMgr::auctionListingTempLock;
|
|||||||
bool AuctionListOwnerItemsDelayEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
|
bool AuctionListOwnerItemsDelayEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
|
||||||
{
|
{
|
||||||
if (Player* plr = ObjectAccessor::FindPlayer(playerguid))
|
if (Player* plr = ObjectAccessor::FindPlayer(playerguid))
|
||||||
plr->GetSession()->HandleAuctionListOwnerItemsEvent(data);
|
plr->GetSession()->HandleAuctionListOwnerItemsEvent(creatureGuid);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
class AuctionListOwnerItemsDelayEvent : public BasicEvent
|
class AuctionListOwnerItemsDelayEvent : public BasicEvent
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AuctionListOwnerItemsDelayEvent(WorldPacket& d, uint64 guid, bool o) : data(d), playerguid(guid), owner(o) {}
|
AuctionListOwnerItemsDelayEvent(uint64 _creatureGuid, uint64 guid, bool o) : creatureGuid(_creatureGuid), playerguid(guid), owner(o) {}
|
||||||
virtual ~AuctionListOwnerItemsDelayEvent() {}
|
virtual ~AuctionListOwnerItemsDelayEvent() {}
|
||||||
|
|
||||||
virtual bool Execute(uint64 e_time, uint32 p_time);
|
virtual bool Execute(uint64 e_time, uint32 p_time);
|
||||||
@@ -16,7 +16,7 @@ class AuctionListOwnerItemsDelayEvent : public BasicEvent
|
|||||||
bool getOwner() { return owner; }
|
bool getOwner() { return owner; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
WorldPacket data;
|
uint64 creatureGuid;
|
||||||
uint64 playerguid;
|
uint64 playerguid;
|
||||||
bool owner;
|
bool owner;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -606,7 +606,7 @@ class WorldSession
|
|||||||
void HandleAuctionSellItem(WorldPacket& recvData);
|
void HandleAuctionSellItem(WorldPacket& recvData);
|
||||||
void HandleAuctionRemoveItem(WorldPacket& recvData);
|
void HandleAuctionRemoveItem(WorldPacket& recvData);
|
||||||
void HandleAuctionListOwnerItems(WorldPacket& recvData);
|
void HandleAuctionListOwnerItems(WorldPacket& recvData);
|
||||||
void HandleAuctionListOwnerItemsEvent(WorldPacket & recvData);
|
void HandleAuctionListOwnerItemsEvent(uint64 creatureGuid);
|
||||||
void HandleAuctionPlaceBid(WorldPacket& recvData);
|
void HandleAuctionPlaceBid(WorldPacket& recvData);
|
||||||
void HandleAuctionListPendingSales(WorldPacket& recvData);
|
void HandleAuctionListPendingSales(WorldPacket& recvData);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user