From 6e94a3345fd6d368d36cd4ffadb229e4942be9a9 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Wed, 11 Mar 2026 14:35:29 -0700 Subject: [PATCH] Add upfront validation to CastFailedParser SMSG_CAST_FAILED (3.3.5a) improvements: - Validate 6-byte minimum for castCount + spellId + result - Prevent reading from truncated packets Ensures consistent error handling for spell failure feedback. --- src/game/world_packets.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/game/world_packets.cpp b/src/game/world_packets.cpp index 607d52ea..42f03d1b 100644 --- a/src/game/world_packets.cpp +++ b/src/game/world_packets.cpp @@ -3243,6 +3243,9 @@ network::Packet PetActionPacket::build(uint64_t petGuid, uint32_t action, uint64 } bool CastFailedParser::parse(network::Packet& packet, CastFailedData& data) { + // WotLK format: castCount(1) + spellId(4) + result(1) = 6 bytes minimum + if (packet.getSize() - packet.getReadPos() < 6) return false; + data.castCount = packet.readUInt8(); data.spellId = packet.readUInt32(); data.result = packet.readUInt8();