mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-31 14:17:28 +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:
@@ -27,8 +27,6 @@
|
||||
|
||||
void WorldSession::HandleGMTicketCreateOpcode( WorldPacket & recv_data )
|
||||
{
|
||||
CHECK_PACKET_SIZE(recv_data, 4*4+1+2*4);
|
||||
|
||||
if(GM_Ticket *ticket = objmgr.GetGMTicketByPlayer(GetPlayer()->GetGUID()))
|
||||
{
|
||||
WorldPacket data( SMSG_GMTICKET_CREATE, 4 );
|
||||
@@ -75,7 +73,6 @@ void WorldSession::HandleGMTicketCreateOpcode( WorldPacket & recv_data )
|
||||
|
||||
void WorldSession::HandleGMTicketUpdateOpcode( WorldPacket & recv_data)
|
||||
{
|
||||
CHECK_PACKET_SIZE(recv_data, 1);
|
||||
WorldPacket data(SMSG_GMTICKET_UPDATETEXT, 4);
|
||||
|
||||
std::string message;
|
||||
|
||||
Reference in New Issue
Block a user