mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 04:37:00 +00:00
[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:
parent
c26c7395a1
commit
a24f39a36f
32 changed files with 129 additions and 741 deletions
|
|
@ -32,8 +32,6 @@
|
|||
|
||||
void WorldSession::HandleAutostoreLootItemOpcode( WorldPacket & recv_data )
|
||||
{
|
||||
CHECK_PACKET_SIZE(recv_data,1);
|
||||
|
||||
sLog.outDebug("WORLD: CMSG_AUTOSTORE_LOOT_ITEM");
|
||||
Player *player = GetPlayer();
|
||||
uint64 lguid = player->GetLootGUID();
|
||||
|
|
@ -240,8 +238,6 @@ void WorldSession::HandleLootMoneyOpcode( WorldPacket & /*recv_data*/ )
|
|||
|
||||
void WorldSession::HandleLootOpcode( WorldPacket & recv_data )
|
||||
{
|
||||
CHECK_PACKET_SIZE(recv_data,8);
|
||||
|
||||
sLog.outDebug("WORLD: CMSG_LOOT");
|
||||
|
||||
uint64 guid;
|
||||
|
|
@ -256,8 +252,6 @@ void WorldSession::HandleLootOpcode( WorldPacket & recv_data )
|
|||
|
||||
void WorldSession::HandleLootReleaseOpcode( WorldPacket & recv_data )
|
||||
{
|
||||
CHECK_PACKET_SIZE(recv_data,8);
|
||||
|
||||
sLog.outDebug("WORLD: CMSG_LOOT_RELEASE");
|
||||
|
||||
// cheaters can modify lguid to prevent correct apply loot release code and re-loot
|
||||
|
|
@ -437,8 +431,6 @@ void WorldSession::DoLootRelease( uint64 lguid )
|
|||
|
||||
void WorldSession::HandleLootMasterGiveOpcode( WorldPacket & recv_data )
|
||||
{
|
||||
CHECK_PACKET_SIZE(recv_data,8+1+8);
|
||||
|
||||
uint8 slotid;
|
||||
uint64 lootguid, target_playerguid;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue