[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
This commit is contained in:
1 parent
d9ed49749d
commit
e954904e6d
30 files changed
+128
-739
No files matched your search
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user