aboutsummaryrefslogtreecommitdiff
path: root/engines/xeen/character.cpp
diff options
context:
space:
mode:
authorPeter Helbing2019-06-07 22:19:06 +0200
committerPaul Gilbert2019-06-09 14:17:23 -0700
commit7c95deb5b6f1311fb34c095fc4df3c979a893f50 (patch)
tree8eb21ac3c9d2c5faf40a5c60e0162baed2670ab4 /engines/xeen/character.cpp
parentf2b8dc4776f0b7c4eabf26b31c5675ccb81e561e (diff)
downloadscummvm-rg350-7c95deb5b6f1311fb34c095fc4df3c979a893f50.tar.gz
scummvm-rg350-7c95deb5b6f1311fb34c095fc4df3c979a893f50.tar.bz2
scummvm-rg350-7c95deb5b6f1311fb34c095fc4df3c979a893f50.zip
XEEN: Check bounds of stat values array, bug #10971
Diffstat (limited to 'engines/xeen/character.cpp')
-rw-r--r--engines/xeen/character.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/engines/xeen/character.cpp b/engines/xeen/character.cpp
index afc013ba89..47ef0b8ecd 100644
--- a/engines/xeen/character.cpp
+++ b/engines/xeen/character.cpp
@@ -418,8 +418,9 @@ int Character::statColor(int amount, int threshold) {
int Character::statBonus(uint statValue) const {
int idx;
- for (idx = 0; Res.STAT_VALUES[idx] <= (int)statValue; ++idx)
- ;
+ for (idx = 0; idx < ARRAYSIZE(Res.STAT_VALUES) - 1; ++idx)
+ if (Res.STAT_VALUES[idx] > (int)statValue)
+ break;
return Res.STAT_BONUSES[idx];
}