mirror of
https://github.com/mangosfour/server.git
synced 2025-12-17 16: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
|
|
@ -30,8 +30,6 @@ void WorldSession::HandleInspectArenaTeamsOpcode(WorldPacket & recv_data)
|
|||
{
|
||||
sLog.outDebug("MSG_INSPECT_ARENA_TEAMS");
|
||||
|
||||
CHECK_PACKET_SIZE(recv_data, 8);
|
||||
|
||||
uint64 guid;
|
||||
recv_data >> guid;
|
||||
sLog.outDebug("Inspect Arena stats (GUID: %u TypeId: %u)", GUID_LOPART(guid),GuidHigh2TypeId(GUID_HIPART(guid)));
|
||||
|
|
@ -53,8 +51,6 @@ void WorldSession::HandleArenaTeamQueryOpcode(WorldPacket & recv_data)
|
|||
{
|
||||
sLog.outDebug( "WORLD: Received CMSG_ARENA_TEAM_QUERY" );
|
||||
|
||||
CHECK_PACKET_SIZE(recv_data, 4);
|
||||
|
||||
uint32 ArenaTeamId;
|
||||
recv_data >> ArenaTeamId;
|
||||
|
||||
|
|
@ -70,8 +66,6 @@ void WorldSession::HandleArenaTeamRosterOpcode(WorldPacket & recv_data)
|
|||
{
|
||||
sLog.outDebug( "WORLD: Received CMSG_ARENA_TEAM_ROSTER" );
|
||||
|
||||
CHECK_PACKET_SIZE(recv_data, 4);
|
||||
|
||||
uint32 ArenaTeamId; // arena team id
|
||||
recv_data >> ArenaTeamId;
|
||||
|
||||
|
|
@ -86,8 +80,6 @@ void WorldSession::HandleArenaTeamInviteOpcode(WorldPacket & recv_data)
|
|||
{
|
||||
sLog.outDebug("CMSG_ARENA_TEAM_INVITE");
|
||||
|
||||
CHECK_PACKET_SIZE(recv_data, 4+1);
|
||||
|
||||
uint32 ArenaTeamId; // arena team id
|
||||
std::string Invitedname;
|
||||
|
||||
|
|
@ -205,8 +197,6 @@ void WorldSession::HandleArenaTeamLeaveOpcode(WorldPacket & recv_data)
|
|||
{
|
||||
sLog.outDebug("CMSG_ARENA_TEAM_LEAVE");
|
||||
|
||||
CHECK_PACKET_SIZE(recv_data, 4);
|
||||
|
||||
uint32 ArenaTeamId; // arena team id
|
||||
recv_data >> ArenaTeamId;
|
||||
|
||||
|
|
@ -242,8 +232,6 @@ void WorldSession::HandleArenaTeamDisbandOpcode(WorldPacket & recv_data)
|
|||
{
|
||||
sLog.outDebug("CMSG_ARENA_TEAM_DISBAND");
|
||||
|
||||
CHECK_PACKET_SIZE(recv_data, 4);
|
||||
|
||||
uint32 ArenaTeamId; // arena team id
|
||||
recv_data >> ArenaTeamId;
|
||||
|
||||
|
|
@ -265,8 +253,6 @@ void WorldSession::HandleArenaTeamRemoveOpcode(WorldPacket & recv_data)
|
|||
{
|
||||
sLog.outDebug("CMSG_ARENA_TEAM_REMOVE");
|
||||
|
||||
CHECK_PACKET_SIZE(recv_data, 4+1);
|
||||
|
||||
uint32 ArenaTeamId;
|
||||
std::string name;
|
||||
|
||||
|
|
@ -311,8 +297,6 @@ void WorldSession::HandleArenaTeamLeaderOpcode(WorldPacket & recv_data)
|
|||
{
|
||||
sLog.outDebug("CMSG_ARENA_TEAM_LEADER");
|
||||
|
||||
CHECK_PACKET_SIZE(recv_data, 4+1);
|
||||
|
||||
uint32 ArenaTeamId;
|
||||
std::string name;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue