Use MAX_SPELL_CHARM as spellcount on GetPetAutoSpellSize(), fixes OOB array-access in Pet::UpdateAI()

Thanks to ge0rg for the heads up and patch

--HG--
branch : trunk
This commit is contained in:
click
2010-07-04 16:15:29 +02:00
parent 079b945a7d
commit cdf3514603

View File

@@ -622,10 +622,10 @@ class Creature : public Unit, public GridObject<Creature>
bool hasInvolvedQuest(uint32 quest_id) const;
bool isRegeneratingHealth() { return m_regenHealth; }
virtual uint8 GetPetAutoSpellSize() const { return CREATURE_MAX_SPELLS; }
virtual uint8 GetPetAutoSpellSize() const { return MAX_SPELL_CHARM; }
virtual uint32 GetPetAutoSpellOnPos(uint8 pos) const
{
if (pos >= CREATURE_MAX_SPELLS || m_charmInfo->GetCharmSpell(pos)->GetType() != ACT_ENABLED)
if (pos >= MAX_SPELL_CHARM || m_charmInfo->GetCharmSpell(pos)->GetType() != ACT_ENABLED)
return 0;
else
return m_charmInfo->GetCharmSpell(pos)->GetAction();