[8378] Use exceptions instead of explicit size checking for each packet

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.
This commit is contained in:
arrai 2009-08-15 22:06:35 +02:00
parent c26c7395a1
commit a24f39a36f
32 changed files with 129 additions and 741 deletions

View file

@ -26,8 +26,6 @@
void WorldSession::HandleDuelAcceptedOpcode(WorldPacket& recvPacket)
{
CHECK_PACKET_SIZE(recvPacket,8);
uint64 guid;
Player *pl;
Player *plTarget;
@ -59,8 +57,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