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.
This commit is contained in:
Kelsi 2026-03-11 14:35:29 -07:00
parent 4f3e817913
commit 6e94a3345f

View file

@ -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();