aboutsummaryrefslogtreecommitdiff
path: root/src/game/GuildHandler.cpp
diff options
context:
space:
mode:
authormegamage <none@none>2009-08-19 17:07:21 -0500
committermegamage <none@none>2009-08-19 17:07:21 -0500
commitc9117721255b24d86f00b3f94c6f112fefa5bfdd (patch)
tree8daf9665b3142c4974c90e38414ae7669db694cc /src/game/GuildHandler.cpp
parentf5085b2f39c91ed0103c79d95f8d18a4ef2a6371 (diff)
[8389] Implement check really read received packet size and warning it not all data read. Author: VladimirMangos
* This let more easy catch packet structure chnages at client switch. * Fixed structure CMSG_GUILD_BANK_SWAP_ITEMS * Fixed structure CMSG_SPLIT_ITEM, CMSG_SELL_ITEM * Added read data amount fixes for some other packets. Thanks to TOM_RUS in help check correct packets structure. Note: not all packets possible fixed. Please report for not fixed cases at errors: "opcode %s (0x%.4X) have unprocessed tail data (read stop at %u from %u)" --HG-- branch : trunk
Diffstat (limited to 'src/game/GuildHandler.cpp')
-rw-r--r--src/game/GuildHandler.cpp38
1 files changed, 21 insertions, 17 deletions
diff --git a/src/game/GuildHandler.cpp b/src/game/GuildHandler.cpp
index 36f8ffbe327..c6ae1fe19c0 100644
--- a/src/game/GuildHandler.cpp
+++ b/src/game/GuildHandler.cpp
@@ -614,12 +614,14 @@ void WorldSession::HandleGuildRankOpcode(WorldPacket& recvPacket)
guild = objmgr.GetGuildById(GetPlayer()->GetGuildId());
if(!guild)
{
+ recvPacket.rpos(recvPacket.wpos()); // set to end to avoid warnings spam
SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_PLAYER_NOT_IN_GUILD);
return;
}
else if(GetPlayer()->GetGUID() != guild->GetLeader())
{
+ recvPacket.rpos(recvPacket.wpos()); // set to end to avoid warnings spam
SendGuildCommandResult(GUILD_INVITE_S, "", GUILD_PERMISSIONS);
return;
}
@@ -1026,10 +1028,14 @@ void WorldSession::HandleGuildBankSwapItems( WorldPacket & recv_data )
uint64 GoGuid;
uint8 BankToBank;
- uint8 BankTab, BankTabSlot, AutoStore, AutoStoreCount, PlayerSlot, PlayerBag, SplitedAmount = 0;
- uint8 BankTabDst, BankTabSlotDst, unk2, ToChar = 1;
+ uint8 BankTab, BankTabSlot, AutoStore;
+ uint8 PlayerSlot = NULL_SLOT;
+ uint8 PlayerBag = NULL_BAG;
+ uint8 BankTabDst, BankTabSlotDst, unk2;
+ uint8 ToChar = 1;
uint32 ItemEntry, unk1;
- bool BankToChar = false;
+ uint32 AutoStoreCount = 0;
+ uint32 SplitedAmount = 0;
recv_data >> GoGuid >> BankToBank;
if (BankToBank)
@@ -1043,10 +1049,11 @@ void WorldSession::HandleGuildBankSwapItems( WorldPacket & recv_data )
recv_data >> unk2; // always 0
recv_data >> SplitedAmount;
- if (BankTabSlotDst >= GUILD_BANK_MAX_SLOTS)
- return;
- if (BankTabDst == BankTab && BankTabSlotDst == BankTabSlot)
+ if (BankTabSlotDst >= GUILD_BANK_MAX_SLOTS || BankTabDst == BankTab && BankTabSlotDst == BankTabSlot)
+ {
+ recv_data.rpos(recv_data.wpos()); // prevent additional spam at rejected packet
return;
+ }
}
else
{
@@ -1057,17 +1064,22 @@ void WorldSession::HandleGuildBankSwapItems( WorldPacket & recv_data )
if (AutoStore)
{
recv_data >> AutoStoreCount;
+ recv_data.read_skip<uint8>(); // ToChar (?), always and expected to be 1 (autostore only triggered in guild->ToChar)
+ recv_data.read_skip<uint32>(); // unknown, always 0
}
- recv_data >> PlayerBag;
- recv_data >> PlayerSlot;
- if (!AutoStore)
+ else
{
+ recv_data >> PlayerBag;
+ recv_data >> PlayerSlot;
recv_data >> ToChar;
recv_data >> SplitedAmount;
}
if (BankTabSlot >= GUILD_BANK_MAX_SLOTS && BankTabSlot != 0xFF)
+ {
+ recv_data.rpos(recv_data.wpos()); // prevent additional spam at rejected packet
return;
+ }
}
if (!GetPlayer()->GetGameObjectIfCanInteractWith(GoGuid, GAMEOBJECT_TYPE_GUILD_BANK))
@@ -1202,14 +1214,6 @@ void WorldSession::HandleGuildBankSwapItems( WorldPacket & recv_data )
// Player <-> Bank
- // char->bank autostore click return BankTabSlot = 255 = NULL_SLOT
- // do similar for bank->char
- if(AutoStore && ToChar)
- {
- PlayerBag = NULL_BAG;
- PlayerSlot = NULL_SLOT;
- }
-
// allow work with inventory only
if(!Player::IsInventoryPos(PlayerBag,PlayerSlot) && !(PlayerBag == NULL_BAG && PlayerSlot == NULL_SLOT) )
{