mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-03-15 05:25:08 +00:00
fix(Core/Pet): Fix possible heap-use-after-free of charmInfo when handling pet action. (#21439)
This commit is contained in:
committed by
GitHub
parent
75441ddb3b
commit
cdcdf4564b
@@ -432,8 +432,14 @@ void WorldSession::HandlePetActionHelper(Unit* pet, ObjectGuid guid1, uint32 spe
|
|||||||
|
|
||||||
spell->prepare(&(spell->m_targets));
|
spell->prepare(&(spell->m_targets));
|
||||||
|
|
||||||
charmInfo->SetForcedSpell(0);
|
// spell->prepare() can delete charm info.
|
||||||
charmInfo->SetForcedTargetGUID();
|
// 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))
|
else if (pet->ToPet() && (result == SPELL_FAILED_LINE_OF_SIGHT || result == SPELL_FAILED_OUT_OF_RANGE))
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user