From e954904e6d0f026254d4ab93c6b4d051cc7253c6 Mon Sep 17 00:00:00 2001 From: megamage Date: Wed, 19 Aug 2009 16:26:22 -0500 Subject: [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 --- src/game/DuelHandler.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src/game/DuelHandler.cpp') diff --git a/src/game/DuelHandler.cpp b/src/game/DuelHandler.cpp index e235395f1f4..c35b9dbdc07 100644 --- a/src/game/DuelHandler.cpp +++ b/src/game/DuelHandler.cpp @@ -28,8 +28,6 @@ void WorldSession::HandleDuelAcceptedOpcode(WorldPacket& recvPacket) { - CHECK_PACKET_SIZE(recvPacket,8); - uint64 guid; Player *pl; Player *plTarget; @@ -61,8 +59,6 @@ void WorldSession::HandleDuelAcceptedOpcode(WorldPacket& recvPacket) void WorldSession::HandleDuelCancelledOpcode(WorldPacket& recvPacket) { - CHECK_PACKET_SIZE(recvPacket,8); - //sLog.outDebug( "WORLD: received CMSG_DUEL_CANCELLED" ); // no duel requested -- cgit v1.2.3