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:
@@ -30,8 +30,6 @@
|
||||
|
||||
void WorldSession::HandleLearnTalentOpcode( WorldPacket & recv_data )
|
||||
{
|
||||
CHECK_PACKET_SIZE(recv_data,4+4);
|
||||
|
||||
uint32 talent_id, requested_rank;
|
||||
recv_data >> talent_id >> requested_rank;
|
||||
|
||||
@@ -43,8 +41,6 @@ void WorldSession::HandleLearnPreviewTalents(WorldPacket& recvPacket)
|
||||
{
|
||||
sLog.outDebug("CMSG_LEARN_PREVIEW_TALENTS");
|
||||
|
||||
CHECK_PACKET_SIZE(recvPacket, 4);
|
||||
|
||||
uint32 talentsCount;
|
||||
recvPacket >> talentsCount;
|
||||
|
||||
@@ -52,8 +48,6 @@ void WorldSession::HandleLearnPreviewTalents(WorldPacket& recvPacket)
|
||||
|
||||
for(uint32 i = 0; i < talentsCount; ++i)
|
||||
{
|
||||
CHECK_PACKET_SIZE(recvPacket, recvPacket.rpos()+4+4);
|
||||
|
||||
recvPacket >> talentId >> talentRank;
|
||||
|
||||
_player->LearnTalent(talentId, talentRank);
|
||||
@@ -64,8 +58,6 @@ void WorldSession::HandleLearnPreviewTalents(WorldPacket& recvPacket)
|
||||
|
||||
void WorldSession::HandleTalentWipeConfirmOpcode( WorldPacket & recv_data )
|
||||
{
|
||||
CHECK_PACKET_SIZE(recv_data,8);
|
||||
|
||||
sLog.outDetail("MSG_TALENT_WIPE_CONFIRM");
|
||||
uint64 guid;
|
||||
recv_data >> guid;
|
||||
@@ -96,8 +88,6 @@ void WorldSession::HandleTalentWipeConfirmOpcode( WorldPacket & recv_data )
|
||||
|
||||
void WorldSession::HandleUnlearnSkillOpcode(WorldPacket & recv_data)
|
||||
{
|
||||
CHECK_PACKET_SIZE(recv_data,4);
|
||||
|
||||
uint32 skill_id;
|
||||
recv_data >> skill_id;
|
||||
GetPlayer()->SetSkill(skill_id, 0, 0);
|
||||
|
||||
Reference in New Issue
Block a user