mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-17 17:43:52 +00:00
fix(combatlog): reject truncated spell start target GUIDs
This commit is contained in:
parent
bcfdcce062
commit
24a63beb3c
3 changed files with 13 additions and 3 deletions
|
|
@ -374,7 +374,8 @@ bool ClassicPacketParsers::parseSpellStart(network::Packet& packet, SpellStartDa
|
||||||
if (rem() < 2) return true;
|
if (rem() < 2) return true;
|
||||||
uint16_t targetFlags = packet.readUInt16();
|
uint16_t targetFlags = packet.readUInt16();
|
||||||
// TARGET_FLAG_UNIT (0x02) or TARGET_FLAG_OBJECT (0x800) carry a packed GUID
|
// TARGET_FLAG_UNIT (0x02) or TARGET_FLAG_OBJECT (0x800) carry a packed GUID
|
||||||
if (((targetFlags & 0x02) || (targetFlags & 0x800)) && hasFullPackedGuid(packet)) {
|
if ((targetFlags & 0x02) || (targetFlags & 0x800)) {
|
||||||
|
if (!hasFullPackedGuid(packet)) return false;
|
||||||
data.targetGuid = UpdateObjectParser::readPackedGuid(packet);
|
data.targetGuid = UpdateObjectParser::readPackedGuid(packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1245,7 +1245,11 @@ bool TbcPacketParsers::parseSpellStart(network::Packet& packet, SpellStartData&
|
||||||
|
|
||||||
if (packet.getReadPos() + 4 <= packet.getSize()) {
|
if (packet.getReadPos() + 4 <= packet.getSize()) {
|
||||||
uint32_t targetFlags = packet.readUInt32();
|
uint32_t targetFlags = packet.readUInt32();
|
||||||
if ((targetFlags & 0x02) && packet.getReadPos() + 8 <= packet.getSize()) {
|
const bool needsTargetGuid = (targetFlags & 0x02) || (targetFlags & 0x800); // UNIT/OBJECT
|
||||||
|
if (needsTargetGuid) {
|
||||||
|
if (packet.getReadPos() + 8 > packet.getSize()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
data.targetGuid = packet.readUInt64(); // full GUID in TBC
|
data.targetGuid = packet.readUInt64(); // full GUID in TBC
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3715,7 +3715,12 @@ bool SpellStartParser::parse(network::Packet& packet, SpellStartData& data) {
|
||||||
// Read target flags and target (simplified)
|
// Read target flags and target (simplified)
|
||||||
if (packet.getSize() - packet.getReadPos() >= 4) {
|
if (packet.getSize() - packet.getReadPos() >= 4) {
|
||||||
uint32_t targetFlags = packet.readUInt32();
|
uint32_t targetFlags = packet.readUInt32();
|
||||||
if ((targetFlags & 0x02) && hasFullPackedGuid(packet)) { // TARGET_FLAG_UNIT
|
const bool needsTargetGuid = (targetFlags & 0x02) || (targetFlags & 0x800); // UNIT/OBJECT
|
||||||
|
if (needsTargetGuid) {
|
||||||
|
if (!hasFullPackedGuid(packet)) {
|
||||||
|
packet.setReadPos(startPos);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
data.targetGuid = UpdateObjectParser::readPackedGuid(packet);
|
data.targetGuid = UpdateObjectParser::readPackedGuid(packet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue