From f0ba85fa80d87c09c52b90486f5a4ed8bfc0800e Mon Sep 17 00:00:00 2001 From: Kelsi Date: Sat, 14 Mar 2026 13:21:38 -0700 Subject: [PATCH] fix(combatlog): reset spell go parser output before decode --- src/game/packet_parsers_classic.cpp | 3 +++ src/game/packet_parsers_tbc.cpp | 3 +++ src/game/world_packets.cpp | 3 +++ 3 files changed, 9 insertions(+) diff --git a/src/game/packet_parsers_classic.cpp b/src/game/packet_parsers_classic.cpp index 995f109b..54fb7f95 100644 --- a/src/game/packet_parsers_classic.cpp +++ b/src/game/packet_parsers_classic.cpp @@ -396,6 +396,9 @@ bool ClassicPacketParsers::parseSpellStart(network::Packet& packet, SpellStartDa // + uint8(missCount) + [PackedGuid(missTarget) + uint8(missType)] × missCount // ============================================================================ bool ClassicPacketParsers::parseSpellGo(network::Packet& packet, SpellGoData& data) { + // Always reset output to avoid stale targets when callers reuse buffers. + data = SpellGoData{}; + auto rem = [&]() { return packet.getSize() - packet.getReadPos(); }; const size_t startPos = packet.getReadPos(); if (rem() < 2) return false; diff --git a/src/game/packet_parsers_tbc.cpp b/src/game/packet_parsers_tbc.cpp index 34f5b283..16f1ffed 100644 --- a/src/game/packet_parsers_tbc.cpp +++ b/src/game/packet_parsers_tbc.cpp @@ -1261,6 +1261,9 @@ bool TbcPacketParsers::parseSpellStart(network::Packet& packet, SpellStartData& // WotLK uses packed GUIDs and adds a timestamp (u32) after castFlags. // ============================================================================ bool TbcPacketParsers::parseSpellGo(network::Packet& packet, SpellGoData& data) { + // Always reset output to avoid stale targets when callers reuse buffers. + data = SpellGoData{}; + const size_t startPos = packet.getReadPos(); // Fixed header before hit/miss lists: // casterGuid(u64) + casterUnit(u64) + castCount(u8) + spellId(u32) + castFlags(u32) diff --git a/src/game/world_packets.cpp b/src/game/world_packets.cpp index 25dc79d2..f057f90b 100644 --- a/src/game/world_packets.cpp +++ b/src/game/world_packets.cpp @@ -3725,6 +3725,9 @@ bool SpellStartParser::parse(network::Packet& packet, SpellStartData& data) { } bool SpellGoParser::parse(network::Packet& packet, SpellGoData& data) { + // Always reset output to avoid stale targets when callers reuse buffers. + data = SpellGoData{}; + // Packed GUIDs are variable-length, so only require the smallest possible // shape up front: 2 GUID masks + fixed fields through missCount. if (packet.getSize() - packet.getReadPos() < 17) return false;