Core/PacketIO: Fix crash and exploit caused when client sends tampered mover guids

Closes: #4056
This commit is contained in:
elecyb
2012-01-05 18:34:56 -03:00
parent 9817771973
commit 7d7bb8363d
3 changed files with 15 additions and 16 deletions
@@ -3096,9 +3096,15 @@ void AuraEffect::HandleModPossess(AuraApplication const* aurApp, uint8 mode, boo
}
if (apply)
target->SetCharmedBy(caster, CHARM_TYPE_POSSESS, aurApp);
{
if (target->SetCharmedBy(caster, CHARM_TYPE_POSSESS, aurApp))
caster->ToPlayer()->SetMover(target);
}
else
{
target->RemoveCharmedBy(caster);
caster->ToPlayer()->SetMover(caster);
}
}
// only one spell has this aura
@@ -3126,11 +3132,13 @@ void AuraEffect::HandleModPossessPet(AuraApplication const* aurApp, uint8 mode,
if (caster->ToPlayer()->GetPet() != pet)
return;
pet->SetCharmedBy(caster, CHARM_TYPE_POSSESS, aurApp);
if (pet->SetCharmedBy(caster, CHARM_TYPE_POSSESS, aurApp))
caster->ToPlayer()->SetMover(pet);
}
else
{
pet->RemoveCharmedBy(caster);
caster->ToPlayer()->SetMover(caster);
if (!pet->IsWithinDistInMap(caster, pet->GetMap()->GetVisibilityRange()))
pet->Remove(PET_SAVE_NOT_IN_SLOT, true);
@@ -4807,7 +4815,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
if (Aura* newAura = target->AddAura(71564, target))
newAura->SetStackAmount(newAura->GetSpellInfo()->StackAmount);
break;
case 59628: // Tricks of the Trade
case 59628: // Tricks of the Trade
if (caster && caster->GetMisdirectionTarget())
target->SetReducedThreatPercent(100, caster->GetMisdirectionTarget()->GetGUID());
break;
@@ -4970,7 +4978,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
target->SetReducedThreatPercent(0,0);
else
target->SetReducedThreatPercent(0,caster->GetMisdirectionTarget()->GetGUID());
break;
break;
}
default:
break;