suppression of while-helpless for tombstone

Avoid the possibility of a user-supplied name interfering with killer
reason truncation.  A monster named ", while" that killed the hero
would result in "killed by <mon-type> called " being displayed on the
tombstone after stripping while-helpless reason to shorten the text.
This commit is contained in:
PatR
2015-12-18 01:59:36 -08:00
parent 20b2120f3f
commit 4604777c16
6 changed files with 17 additions and 18 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 rip.c $NHDT-Date: 1450410547 2015/12/18 03:49:07 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.21 $ */
/* NetHack 3.6 rip.c $NHDT-Date: 1450432760 2015/12/18 09:59:20 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.22 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -91,7 +91,7 @@ time_t when;
{
register char **dp;
register char *dpx;
char buf[BUFSZ], *p;
char buf[BUFSZ];
long year;
register int x;
int line;
@@ -112,10 +112,7 @@ time_t when;
center(GOLD_LINE, buf);
/* Put together death description */
formatkiller(buf, sizeof buf, how);
/* strip ", while helpless" to keep reason shorter */
if ((p = strstr(buf, ", while")) != 0)
*p = '\0';
formatkiller(buf, sizeof buf, how, FALSE);
/* Put death type on stone */
for (line = DEATH_LINE, dpx = buf; line < YEAR_LINE; line++) {