fix: correct SMSG_SPELLDISPELLOG entry size from 8 to 5 bytes

Each dispelled spell entry is uint32(spellId) + uint8(isPositive) = 5 bytes,
not uint32 + uint32 = 8 bytes as the loop previously assumed.

The incorrect stride caused the second and subsequent entries to be read at
wrong offsets, potentially showing the wrong spell name for multi-dispels.
This commit is contained in:
Kelsi 2026-03-11 02:57:05 -07:00
parent 603e52e5b0
commit ae6c2aa056

View file

@ -5267,10 +5267,11 @@ void GameHandler::handlePacket(network::Packet& packet) {
if (victimGuid == playerGuid || casterGuid == playerGuid) {
const char* verb = isStolen ? "stolen" : "dispelled";
// Collect first dispelled spell name for the message
// Each entry: uint32 spellId + uint8 isPositive (5 bytes in WotLK/TBC/Classic)
std::string firstSpellName;
for (uint32_t i = 0; i < count && packet.getSize() - packet.getReadPos() >= 8; ++i) {
for (uint32_t i = 0; i < count && packet.getSize() - packet.getReadPos() >= 5; ++i) {
uint32_t dispelledId = packet.readUInt32();
/*uint32_t unk =*/ packet.readUInt32();
/*uint8_t isPositive =*/ packet.readUInt8();
if (i == 0) {
const std::string& nm = getSpellName(dispelledId);
firstSpellName = nm.empty() ? ("spell " + std::to_string(dispelledId)) : nm;