From 95acf0d93a3fc65e5e7c745e53875a2170868673 Mon Sep 17 00:00:00 2001 From: PatR Date: Sun, 23 Dec 2018 12:03:53 -0800 Subject: [PATCH] avoid checkfile() segfault Recent change for "pair of lenses names The Eyes of the Overworld" triggered a segfault if item was neither named nor called. --- doc/fixes36.2 | 1 + src/pager.c | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/doc/fixes36.2 b/doc/fixes36.2 index e08f5de5c..01b2f33b7 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -336,6 +336,7 @@ a config file line with OPTIONS=symset:default, roguesymset:RogueEpyx meant to have color; that was due to an errant init_symbols() call during the processing of symset:default done after RogueEpyx had already been processed +avoid potential segfault when doing 'more information' lookup tty: turn off an optimization that is the suspected cause of Windows reported partial status lines following level changes tty: ensure that current status fields are always copied to prior status diff --git a/src/pager.c b/src/pager.c index f15c40f59..e8748452e 100644 --- a/src/pager.c +++ b/src/pager.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 pager.c $NHDT-Date: 1545361111 2018/12/21 02:58:31 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.143 $ */ +/* NetHack 3.6 pager.c $NHDT-Date: 1545595360 2018/12/23 20:02:40 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.144 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2018. */ /* NetHack may be freely redistributed. See license for details. */ @@ -646,9 +646,9 @@ char *supplemental_name; The Eyes of the Overworld" simplified above to "lenses named The Eyes of the Overworld", now reduced to "The Eyes of the Overworld", skip "The" as with base name processing) */ - if (!strncmpi(alt, "a ", 2) - || !strncmpi(alt, "an ", 3) - || !strncmpi(alt, "the ", 4)) + if (alt && (!strncmpi(alt, "a ", 2) + || !strncmpi(alt, "an ", 3) + || !strncmpi(alt, "the ", 4))) alt = index(alt, ' ') + 1; /* remove charges or "(lit)" or wizmode "(N aum)" */ if ((ep = strstri(dbase_str, " (")) != 0 && ep > dbase_str) -- 2.40.0