aboutsummaryrefslogtreecommitdiff
path: root/src/game/PetHandler.cpp
diff options
context:
space:
mode:
authormegamage <none@none>2009-08-19 16:26:22 -0500
committermegamage <none@none>2009-08-19 16:26:22 -0500
commite954904e6d0f026254d4ab93c6b4d051cc7253c6 (patch)
tree24374c0508ddd062dccb7b30bb7455eb9a191b3c /src/game/PetHandler.cpp
parentd9ed49749db71f971c650c109d5bc1ce8af5d8ad (diff)
[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
Diffstat (limited to 'src/game/PetHandler.cpp')
-rw-r--r--src/game/PetHandler.cpp23
1 files changed, 0 insertions, 23 deletions
diff --git a/src/game/PetHandler.cpp b/src/game/PetHandler.cpp
index 3de8ee028d3..3b192fa13fb 100644
--- a/src/game/PetHandler.cpp
+++ b/src/game/PetHandler.cpp
@@ -34,8 +34,6 @@
void WorldSession::HandlePetAction( WorldPacket & recv_data )
{
- CHECK_PACKET_SIZE(recv_data, 8+2+2+8);
-
uint64 guid1;
uint32 data;
uint64 guid2;
@@ -306,8 +304,6 @@ void WorldSession::HandlePetActionHelper(Unit *pet, uint64 guid1, uint16 spellid
void WorldSession::HandlePetNameQuery( WorldPacket & recv_data )
{
- CHECK_PACKET_SIZE(recv_data,4+8);
-
sLog.outDetail( "HandlePetNameQuery. CMSG_PET_NAME_QUERY" );
uint32 petnumber;
@@ -346,8 +342,6 @@ void WorldSession::SendPetNameQuery( uint64 petguid, uint32 petnumber)
void WorldSession::HandlePetSetAction( WorldPacket & recv_data )
{
- CHECK_PACKET_SIZE(recv_data, 8+4+2+2);
-
sLog.outDetail( "HandlePetSetAction. CMSG_PET_SET_ACTION" );
uint64 petguid;
@@ -416,8 +410,6 @@ void WorldSession::HandlePetSetAction( WorldPacket & recv_data )
void WorldSession::HandlePetRename( WorldPacket & recv_data )
{
- CHECK_PACKET_SIZE(recv_data, 8+1);
-
sLog.outDetail( "HandlePetRename. CMSG_PET_RENAME" );
uint64 petguid;
@@ -428,7 +420,6 @@ void WorldSession::HandlePetRename( WorldPacket & recv_data )
recv_data >> petguid;
recv_data >> name;
- CHECK_PACKET_SIZE(recv_data, recv_data.rpos() + 1);
recv_data >> isdeclined;
Pet* pet = ObjectAccessor::GetPet(petguid);
@@ -463,7 +454,6 @@ void WorldSession::HandlePetRename( WorldPacket & recv_data )
{
for(uint8 i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
{
- CHECK_PACKET_SIZE(recv_data, recv_data.rpos() + 1);
recv_data >> declinedname.name[i];
}
@@ -495,8 +485,6 @@ void WorldSession::HandlePetRename( WorldPacket & recv_data )
void WorldSession::HandlePetAbandon( WorldPacket & recv_data )
{
- CHECK_PACKET_SIZE(recv_data, 8);
-
uint64 guid;
recv_data >> guid; //pet guid
sLog.outDetail( "HandlePetAbandon. CMSG_PET_ABANDON pet guid is %u", GUID_LOPART(guid) );
@@ -525,8 +513,6 @@ void WorldSession::HandlePetAbandon( WorldPacket & recv_data )
void WorldSession::HandlePetUnlearnOpcode(WorldPacket& recvPacket)
{
- CHECK_PACKET_SIZE(recvPacket,8);
-
sLog.outDetail("CMSG_PET_UNLEARN");
uint64 guid;
recvPacket >> guid; // Pet guid
@@ -554,8 +540,6 @@ void WorldSession::HandlePetUnlearnOpcode(WorldPacket& recvPacket)
void WorldSession::HandlePetSpellAutocastOpcode( WorldPacket& recvPacket )
{
- CHECK_PACKET_SIZE(recvPacket,8+2+2+1);
-
sLog.outDetail("CMSG_PET_SPELL_AUTOCAST");
uint64 guid;
uint32 spellid;
@@ -599,7 +583,6 @@ void WorldSession::HandlePetCastSpellOpcode( WorldPacket& recvPacket )
{
sLog.outDetail("WORLD: CMSG_PET_CAST_SPELL");
- CHECK_PACKET_SIZE(recvPacket,8+1+4+1);
uint64 guid;
uint32 spellid;
uint8 cast_count;
@@ -709,8 +692,6 @@ void WorldSession::HandlePetLearnTalent( WorldPacket & recv_data )
{
sLog.outDebug("WORLD: CMSG_PET_LEARN_TALENT");
- CHECK_PACKET_SIZE(recv_data, 8+4+4);
-
uint64 guid;
uint32 talent_id, requested_rank;
recv_data >> guid >> talent_id >> requested_rank;
@@ -723,8 +704,6 @@ void WorldSession::HandleLearnPreviewTalentsPet( WorldPacket & recv_data )
{
sLog.outDebug("CMSG_LEARN_PREVIEW_TALENTS_PET");
- CHECK_PACKET_SIZE(recv_data, 8+4);
-
uint64 guid;
recv_data >> guid;
@@ -735,8 +714,6 @@ void WorldSession::HandleLearnPreviewTalentsPet( WorldPacket & recv_data )
for(uint32 i = 0; i < talentsCount; ++i)
{
- CHECK_PACKET_SIZE(recv_data, recv_data.rpos()+4+4);
-
recv_data >> talentId >> talentRank;
_player->LearnPetTalent(guid, talentId, talentRank);