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/BattleGroundHandler.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/BattleGroundHandler.cpp')
-rw-r--r-- | src/game/BattleGroundHandler.cpp | 18 |
1 files changed, 0 insertions, 18 deletions
diff --git a/src/game/BattleGroundHandler.cpp b/src/game/BattleGroundHandler.cpp index b1309063b3b..45323313e89 100644 --- a/src/game/BattleGroundHandler.cpp +++ b/src/game/BattleGroundHandler.cpp @@ -37,8 +37,6 @@ void WorldSession::HandleBattlemasterHelloOpcode( WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data, 8); - uint64 guid; recv_data >> guid; sLog.outDebug( "WORLD: Recvd CMSG_BATTLEMASTER_HELLO Message from (GUID: %u TypeId:%u)", GUID_LOPART(guid),GuidHigh2TypeId(GUID_HIPART(guid))); @@ -74,8 +72,6 @@ void WorldSession::SendBattlegGroundList( uint64 guid, BattleGroundTypeId bgType void WorldSession::HandleBattlemasterJoinOpcode( WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data, 8+4+4+1); - uint64 guid; uint32 bgTypeId_; uint32 instanceId; @@ -278,8 +274,6 @@ void WorldSession::HandlePVPLogDataOpcode( WorldPacket & /*recv_data*/ ) void WorldSession::HandleBattlefieldListOpcode( WorldPacket &recv_data ) { - CHECK_PACKET_SIZE(recv_data, 4 + 1); - sLog.outDebug( "WORLD: Recvd CMSG_BATTLEFIELD_LIST Message"); uint32 bgTypeId; @@ -302,8 +296,6 @@ void WorldSession::HandleBattlefieldListOpcode( WorldPacket &recv_data ) void WorldSession::HandleBattleFieldPortOpcode( WorldPacket &recv_data ) { - CHECK_PACKET_SIZE(recv_data, 1+1+4+2+1); - sLog.outDebug( "WORLD: Recvd CMSG_BATTLEFIELD_PORT Message"); uint8 type; // arenatype if arena @@ -502,8 +494,6 @@ void WorldSession::HandleBattleFieldPortOpcode( WorldPacket &recv_data ) void WorldSession::HandleLeaveBattlefieldOpcode( WorldPacket & /*recv_data*/ ) { - //CHECK_PACKET_SIZE(recv_data, 1+1+4+2); - sLog.outDebug( "WORLD: Recvd CMSG_LEAVE_BATTLEFIELD Message"); //uint8 unk1, unk2; @@ -586,8 +576,6 @@ void WorldSession::HandleAreaSpiritHealerQueryOpcode( WorldPacket & recv_data ) { sLog.outDebug("WORLD: CMSG_AREA_SPIRIT_HEALER_QUERY"); - CHECK_PACKET_SIZE(recv_data, 8); - BattleGround *bg = _player->GetBattleGround(); if (!bg) return; @@ -609,8 +597,6 @@ void WorldSession::HandleAreaSpiritHealerQueueOpcode( WorldPacket & recv_data ) { sLog.outDebug("WORLD: CMSG_AREA_SPIRIT_HEALER_QUEUE"); - CHECK_PACKET_SIZE(recv_data, 8); - BattleGround *bg = _player->GetBattleGround(); if (!bg) return; @@ -630,8 +616,6 @@ void WorldSession::HandleAreaSpiritHealerQueueOpcode( WorldPacket & recv_data ) void WorldSession::HandleBattlemasterJoinArena( WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data, 8+1+1+1); - sLog.outDebug("WORLD: CMSG_BATTLEMASTER_JOIN_ARENA"); recv_data.hexlike(); @@ -785,8 +769,6 @@ void WorldSession::HandleBattlemasterJoinArena( WorldPacket & recv_data ) void WorldSession::HandleReportPvPAFK( WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data, 8); - uint64 playerGuid; recv_data >> playerGuid; Player *reportedPlayer = objmgr.GetPlayer(playerGuid); |