mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-02-02 15:17:27 +01:00
[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:
@@ -207,8 +207,6 @@ void WorldSession::HandleLfmClearOpcode( WorldPacket & /*recv_data */)
|
||||
|
||||
void WorldSession::HandleSetLfmOpcode( WorldPacket & recv_data )
|
||||
{
|
||||
CHECK_PACKET_SIZE(recv_data, 4+1+1+1+1);
|
||||
|
||||
sLog.outDebug("CMSG_SET_LOOKING_FOR_MORE");
|
||||
//recv_data.hexlike();
|
||||
uint32 temp, entry, type;
|
||||
@@ -231,8 +229,6 @@ void WorldSession::HandleSetLfmOpcode( WorldPacket & recv_data )
|
||||
|
||||
void WorldSession::HandleSetLfgCommentOpcode( WorldPacket & recv_data )
|
||||
{
|
||||
CHECK_PACKET_SIZE(recv_data, 1);
|
||||
|
||||
sLog.outDebug("CMSG_SET_LFG_COMMENT");
|
||||
//recv_data.hexlike();
|
||||
|
||||
@@ -245,8 +241,6 @@ void WorldSession::HandleSetLfgCommentOpcode( WorldPacket & recv_data )
|
||||
|
||||
void WorldSession::HandleLookingForGroup(WorldPacket& recv_data)
|
||||
{
|
||||
CHECK_PACKET_SIZE(recv_data, 4+4+4);
|
||||
|
||||
sLog.outDebug("MSG_LOOKING_FOR_GROUP");
|
||||
//recv_data.hexlike();
|
||||
uint32 type, entry, unk;
|
||||
@@ -399,8 +393,6 @@ void WorldSession::SendLfgResult(uint32 type, uint32 entry, uint8 lfg_type)
|
||||
|
||||
void WorldSession::HandleSetLfgOpcode( WorldPacket & recv_data )
|
||||
{
|
||||
CHECK_PACKET_SIZE(recv_data, 4+4+1+1);
|
||||
|
||||
sLog.outDebug("CMSG_SET_LOOKING_FOR_GROUP");
|
||||
recv_data.hexlike();
|
||||
uint32 slot, temp, entry, type;
|
||||
@@ -427,8 +419,6 @@ void WorldSession::HandleSetLfgOpcode( WorldPacket & recv_data )
|
||||
|
||||
void WorldSession::HandleLfgSetRoles(WorldPacket &recv_data)
|
||||
{
|
||||
CHECK_PACKET_SIZE(recv_data, 1);
|
||||
|
||||
sLog.outDebug("CMSG_LFG_SET_ROLES");
|
||||
|
||||
uint8 roles;
|
||||
|
||||
Reference in New Issue
Block a user