Jump to content

[FIX] packet size error in ServerPktHeader if isLargePacket


eggxp

Recommended Posts

Patch:

10775

Bug:

packet size error in ServerPktHeader if isLargePacket

Ticket:

https://mangos.lighthouseapp.com/projects/18208-mangos/tickets/658-packet-size-error-in-serverpktheader-if-islargepacket

Code:

From 1dc248db7504b7f9b3d84b88c9ec9769f7cd7471 Mon Sep 17 00:00:00 2001
From: eggxp <[email protected]>
Date: Mon, 22 Nov 2010 08:56:54 +0800
Subject: [PATCH] [Fix] packet size error for LargePacket

---
src/game/WorldSocket.cpp |    3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/game/WorldSocket.cpp b/src/game/WorldSocket.cpp
index 413bd4c..8383125 100644
--- a/src/game/WorldSocket.cpp
+++ b/src/game/WorldSocket.cpp
@@ -167,7 +167,8 @@ int WorldSocket::SendPacket (const WorldPacket& pct)
    // Dump outgoing packet.
    sLog.outWorldPacketDump(uint32(get_handle()), pct.GetOpcode(), LookupOpcodeName(pct.GetOpcode()), &pct, false);

-    ServerPktHeader header(pct.size()+2, pct.GetOpcode());
+    int pctSize = pct.size()+2 > 0x7FFF ? pct.size()+3:pct.size()+2;
+    ServerPktHeader header(pctSize, pct.GetOpcode());
    m_Crypt.EncryptSend ((uint8*)header.header, header.getHeaderLength());

    if (m_OutBuffer->space () >= pct.size () + header.getHeaderLength() && msg_queue()->is_empty())
-- 
1.7.3.1.msysgit.0


in pub wow in dalaran, when player login, the SMSG_COMPRESSED_UPDATE_OBJECT packet size will be > 50000 bytes, and it's a large packet. totalsize = packetSize + 3

Link to comment
Share on other sites

ServerPktHeader arg `size`is "* size is the length of the payload _plus_ the length of the opcode"

So 2 is opcode size.

Real size calculated in

    uint8 getHeaderLength()
   {
       // cmd = 2 bytes, size= 2||3bytes
       return 2+(isLargePacket()?3:2);
   }

Packet size field store data+opcode size and as i look current code correctly check this...

In any case if we must select by full packet size then need fix ServerPktHeader::isLargePacket

instead suggested way

But this can be proved only if will find packet when data+opcode <= 0x7FFF but full packet > 0x7FFF

That very hard i think.

Link to comment
Share on other sites

BTW: how do you guys figer out such things, with help of blizz or just IDA wow.exe?

once a month we have a little meeting with the lead developers from blizzard and they give us the newest informations. we're actually on their payroll. they pay us for holding back your patches, otherwise mangos would already have everything implemented 100%

i guess you can answer your question yourself... ;)

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use