Fix another out-of-bounds error

Monster trying to decide if a tin could cure stoning looking at
a special or empty tin would do acidic(&mons[-1])
This commit is contained in:
Pasi Kallinen
2019-12-29 16:31:51 +02:00
parent d7e3331129
commit 4c82594193
2 changed files with 3 additions and 0 deletions

View File

@@ -23,6 +23,7 @@ change crysknife from mineral to bone and worm tooth from unspecified to bone
worn meat ring shouldn't cause increased hunger; neither should fake Amulet
worn +0 ring of protection should cause increased hunger if it is the only
source of extrinsic Protection
fix accessing mons[-1] when monster figures out if a tin cures stoning
Fixes to 3.7.0-x Problems that Were Exposed Via git Repository

View File

@@ -2313,6 +2313,8 @@ boolean tinok;
if (obj->otyp != CORPSE && (obj->otyp != TIN || !tinok))
return FALSE;
/* corpse, or tin that mon can open */
if (obj->corpsenm == NON_PM) /* empty/special tin */
return FALSE;
return (boolean) (obj->corpsenm == PM_LIZARD
|| (acidic(&mons[obj->corpsenm])
&& (obj->corpsenm != PM_GREEN_SLIME