Core/Players: Fix out of bound access (by MoltenDev)

This commit is contained in:
Spp
2011-12-28 12:32:48 +01:00
parent c1513b2c05
commit 48829f8ffb

View File

@@ -6174,6 +6174,7 @@ bool Player::UpdateFishingSkill()
// bonus abilities in sSkillLineAbilityStore
// Used only to avoid scan DBC at each skill grow
static uint32 bonusSkillLevels[] = {75, 150, 225, 300, 375, 450};
static const size_t bonusSkillLevelsSize = sizeof(bonusSkillLevels) / sizeof(uint32);
bool Player::UpdateSkillPro(uint16 SkillId, int32 Chance, uint32 step)
{
@@ -6211,9 +6212,10 @@ bool Player::UpdateSkillPro(uint16 SkillId, int32 Chance, uint32 step)
SetUInt32Value(valueIndex, MAKE_SKILL_VALUE(new_value, MaxValue));
if (itr->second.uState != SKILL_NEW)
itr->second.uState = SKILL_CHANGED;
for (uint32* bsl = &bonusSkillLevels[0]; *bsl; ++bsl)
for (size_t i = 0; i < bonusSkillLevelsSize; ++i)
{
if ((SkillValue < *bsl && new_value >= *bsl))
uint32 bsl = bonusSkillLevels[i];
if (SkillValue < bsl && new_value >= bsl)
{
learnSkillRewardedSpells(SkillId, new_value);
break;