mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-20 09:17:36 +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:
@@ -129,8 +129,6 @@ void WorldSession::SendNameQueryOpcodeFromDBCallBack(QueryResult *result, uint32
|
||||
|
||||
void WorldSession::HandleNameQueryOpcode( WorldPacket & recv_data )
|
||||
{
|
||||
CHECK_PACKET_SIZE(recv_data, 8);
|
||||
|
||||
uint64 guid;
|
||||
|
||||
recv_data >> guid;
|
||||
@@ -154,8 +152,6 @@ void WorldSession::HandleQueryTimeOpcode( WorldPacket & /*recv_data*/ )
|
||||
/// Only _static_ data send in this packet !!!
|
||||
void WorldSession::HandleCreatureQueryOpcode( WorldPacket & recv_data )
|
||||
{
|
||||
CHECK_PACKET_SIZE(recv_data,4+8);
|
||||
|
||||
uint32 entry;
|
||||
recv_data >> entry;
|
||||
|
||||
@@ -223,8 +219,6 @@ void WorldSession::HandleCreatureQueryOpcode( WorldPacket & recv_data )
|
||||
/// Only _static_ data send in this packet !!!
|
||||
void WorldSession::HandleGameObjectQueryOpcode( WorldPacket & recv_data )
|
||||
{
|
||||
CHECK_PACKET_SIZE(recv_data,4+8);
|
||||
|
||||
uint32 entryID;
|
||||
recv_data >> entryID;
|
||||
|
||||
@@ -335,8 +329,6 @@ void WorldSession::HandleCorpseQueryOpcode(WorldPacket & /*recv_data*/)
|
||||
|
||||
void WorldSession::HandleNpcTextQueryOpcode( WorldPacket & recv_data )
|
||||
{
|
||||
CHECK_PACKET_SIZE(recv_data, 4 + 8);
|
||||
|
||||
uint32 textID;
|
||||
uint64 guid;
|
||||
|
||||
@@ -423,8 +415,6 @@ void WorldSession::HandleNpcTextQueryOpcode( WorldPacket & recv_data )
|
||||
|
||||
void WorldSession::HandlePageTextQueryOpcode( WorldPacket & recv_data )
|
||||
{
|
||||
CHECK_PACKET_SIZE(recv_data, 4);
|
||||
|
||||
uint32 pageID;
|
||||
|
||||
recv_data >> pageID;
|
||||
|
||||
Reference in New Issue
Block a user