From 53e72acb9845dd6db90bc7705e2ae12b3f91de7a Mon Sep 17 00:00:00 2001 From: nhmall Date: Mon, 26 Nov 2018 10:59:57 -0500 Subject: [PATCH] correct sz error when gang parameter is null --- src/do_name.c | 8 ++++++-- src/pager.c | 10 ++++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/do_name.c b/src/do_name.c index 88735f6e1..c1210bbd9 100644 --- a/src/do_name.c +++ b/src/do_name.c @@ -2096,8 +2096,12 @@ const char *gang, *other; char buf[BUFSZ], buf2[BUFSZ], *orcname; orcname = rndorcname(buf2); - sz = (int) ((gang ? strlen(gang) : other ? strlen(other) : 0) - + strlen(orcname) + sizeof " of " - sizeof ""); + sz = (int) strlen(orcname); + if (gang) + sz += (int) (strlen(gang) + sizeof " of " - sizeof ""); + else if (other) + sz += (int) strlen(other); + if (sz < BUFSZ) { char gbuf[BUFSZ]; boolean nameit = FALSE; diff --git a/src/pager.c b/src/pager.c index 27d274adc..e9fe016ed 100644 --- a/src/pager.c +++ b/src/pager.c @@ -1353,10 +1353,12 @@ static const char *suptext1[] = { }; static const char *suptext2[] = { - "%s is a nefarious orc who is known to acquire", - "property from thieves and sell it off for profit", - "or gain. The perpetrator was last seen hanging", - "around the stairs leading to the Gnomish Mines.", + "\"%s\" is the common dungeon name of", + "a nefarious orc who is known to acquire property", + "from thieves and sell it off for profit.", + "", + "The perpetrator was last seen hanging around the", + "stairs leading to the Gnomish Mines.", (char *) 0, };