fix(Core/Pet): Fix possible heap-use-after-free of charmInfo when handling pet action. (#21439)
This commit is contained in:
parent
75441ddb3b
commit
cdcdf4564b
@ -432,8 +432,14 @@ void WorldSession::HandlePetActionHelper(Unit* pet, ObjectGuid guid1, uint32 spe
|
||||
|
||||
spell->prepare(&(spell->m_targets));
|
||||
|
||||
charmInfo->SetForcedSpell(0);
|
||||
charmInfo->SetForcedTargetGUID();
|
||||
// spell->prepare() can delete charm info.
|
||||
// Let's refresh the pointer.
|
||||
charmInfo = pet->GetCharmInfo();
|
||||
if (charmInfo)
|
||||
{
|
||||
charmInfo->SetForcedSpell(0);
|
||||
charmInfo->SetForcedTargetGUID();
|
||||
}
|
||||
}
|
||||
else if (pet->ToPet() && (result == SPELL_FAILED_LINE_OF_SIGHT || result == SPELL_FAILED_OUT_OF_RANGE))
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user