diff options
author | megamage <none@none> | 2009-08-19 16:26:22 -0500 |
---|---|---|
committer | megamage <none@none> | 2009-08-19 16:26:22 -0500 |
commit | e954904e6d0f026254d4ab93c6b4d051cc7253c6 (patch) | |
tree | 24374c0508ddd062dccb7b30bb7455eb9a191b3c /src/game/NPCHandler.cpp | |
parent | d9ed49749db71f971c650c109d5bc1ce8af5d8ad (diff) |
[8378] Use exceptions instead of explicit size checking for each packet Author: arrai
CHECK_PACKET_SIZE was pretty error prone; once it was forgotten mangosd
could crash due to the asserts in ByteBuffer.h. That was exploitable by
malicious players.
Furthermore, there were duplicate checks: Additionally to
CHECK_PACKET_SIZE, the ByteBuffer assertions keept an eye
on not exceeding the packet boundaries - just to crash the server for
sure in such a case.
To prevent memory leaks or other undesirable states, please read in
every handler all variables _before_ doing any concrete handling.
--HG--
branch : trunk
Diffstat (limited to 'src/game/NPCHandler.cpp')
-rw-r--r-- | src/game/NPCHandler.cpp | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/src/game/NPCHandler.cpp b/src/game/NPCHandler.cpp index bb9823ee71f..4e15fd77595 100644 --- a/src/game/NPCHandler.cpp +++ b/src/game/NPCHandler.cpp @@ -40,8 +40,6 @@ void WorldSession::HandleTabardVendorActivateOpcode( WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data,8); - uint64 guid; recv_data >> guid; @@ -68,8 +66,6 @@ void WorldSession::SendTabardVendorActivate( uint64 guid ) void WorldSession::HandleBankerActivateOpcode( WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data,8); - uint64 guid; sLog.outDebug( "WORLD: Received CMSG_BANKER_ACTIVATE" ); @@ -99,8 +95,6 @@ void WorldSession::SendShowBank( uint64 guid ) void WorldSession::HandleTrainerListOpcode( WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data,8); - uint64 guid; recv_data >> guid; @@ -198,8 +192,6 @@ void WorldSession::SendTrainerList( uint64 guid, const std::string& strTitle ) void WorldSession::HandleTrainerBuySpellOpcode( WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data,8+4); - uint64 guid; uint32 spellId = 0; @@ -265,8 +257,6 @@ void WorldSession::HandleTrainerBuySpellOpcode( WorldPacket & recv_data ) void WorldSession::HandleGossipHelloOpcode( WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data,8); - sLog.outDebug( "WORLD: Received CMSG_GOSSIP_HELLO" ); uint64 guid; @@ -311,8 +301,6 @@ void WorldSession::HandleGossipHelloOpcode( WorldPacket & recv_data ) /*void WorldSession::HandleGossipSelectOptionOpcode( WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data,8+4+4); - sLog.outDebug("WORLD: CMSG_GOSSIP_SELECT_OPTION"); uint32 option; @@ -324,8 +312,6 @@ void WorldSession::HandleGossipHelloOpcode( WorldPacket & recv_data ) if(_player->PlayerTalkClass->GossipOptionCoded( option )) { - // recheck - CHECK_PACKET_SIZE(recv_data,8+4+1); sLog.outDebug("reading string"); recv_data >> code; sLog.outDebug("string read: %s", code.c_str()); @@ -356,8 +342,6 @@ void WorldSession::HandleGossipHelloOpcode( WorldPacket & recv_data ) void WorldSession::HandleSpiritHealerActivateOpcode( WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data,8); - sLog.outDebug("WORLD: CMSG_SPIRIT_HEALER_ACTIVATE"); uint64 guid; @@ -417,8 +401,6 @@ void WorldSession::SendSpiritResurrect() void WorldSession::HandleBinderActivateOpcode( WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data,8); - uint64 npcGUID; recv_data >> npcGUID; @@ -490,8 +472,6 @@ void WorldSession::SendBindPoint(Creature *npc) void WorldSession::HandleListStabledPetsOpcode( WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data,8); - sLog.outDebug("WORLD: Recv MSG_LIST_STABLED_PETS"); uint64 npcGUID; @@ -570,8 +550,6 @@ void WorldSession::SendStablePet(uint64 guid ) void WorldSession::HandleStablePet( WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data, 8); - sLog.outDebug("WORLD: Recv CMSG_STABLE_PET"); uint64 npcGUID; @@ -639,8 +617,6 @@ void WorldSession::HandleStablePet( WorldPacket & recv_data ) void WorldSession::HandleUnstablePet( WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data, 8+4); - sLog.outDebug("WORLD: Recv CMSG_UNSTABLE_PET."); uint64 npcGUID; uint32 petnumber; @@ -719,8 +695,6 @@ void WorldSession::HandleUnstablePet( WorldPacket & recv_data ) void WorldSession::HandleBuyStableSlot( WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data, 8); - sLog.outDebug("WORLD: Recv CMSG_BUY_STABLE_SLOT."); uint64 npcGUID; @@ -764,8 +738,6 @@ void WorldSession::HandleStableRevivePet( WorldPacket &/* recv_data */) void WorldSession::HandleStableSwapPet( WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data, 8+4); - sLog.outDebug("WORLD: Recv CMSG_STABLE_SWAP_PET."); uint64 npcGUID; uint32 pet_number; @@ -837,8 +809,6 @@ void WorldSession::HandleStableSwapPet( WorldPacket & recv_data ) void WorldSession::HandleRepairItemOpcode( WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data, 8+8+1); - sLog.outDebug("WORLD: CMSG_REPAIR_ITEM"); uint64 npcGUID, itemGUID; |