diff --git a/doc/fixes35.0 b/doc/fixes35.0 index d1cd02932..34a6ac9b4 100644 --- a/doc/fixes35.0 +++ b/doc/fixes35.0 @@ -880,6 +880,8 @@ message inconsistency: death message "swallowed whole" was preceded by "You bite into" improve the messaging when a monster you can't see is causing an obstruction add option mention_walls, which gives feedback when bumping against a wall +fix invalid pointer dereference in morguemon if ndemon returns NON_PM + Platform- and/or Interface-Specific Fixes ----------------------------------------- diff --git a/src/mkroom.c b/src/mkroom.c index 7f94076e7..2581ce996 100644 --- a/src/mkroom.c +++ b/src/mkroom.c @@ -1,4 +1,4 @@ -/* NetHack 3.5 mkroom.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */ +/* NetHack 3.5 mkroom.c $NHDT-Date: 1427239202 2015/03/24 23:20:02 $ $NHDT-Branch: master $:$NHDT-Revision: 1.16 $ */ /* NetHack 3.5 mkroom.c $Date: 2012/01/10 17:47:19 $ $Revision: 1.15 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -408,9 +408,17 @@ morguemon() { register int i = rn2(100), hd = rn2(level_difficulty()); - if(hd > 10 && i < 10) - return((Inhell || In_endgame(&u.uz)) ? mkclass(S_DEMON,0) : - &mons[ndemon(A_NONE)]); + if(hd > 10 && i < 10) { + if (Inhell || In_endgame(&u.uz)) { + return(mkclass(S_DEMON,0)); + } else { + int ndemon_res = ndemon(A_NONE); + if (ndemon_res != NON_PM) + return(&mons[ndemon_res]); + /* else do what? As is, it will drop to ghost/wraith/zombie */ + } + } + if(hd > 8 && i > 85) return(mkclass(S_VAMPIRE,0));