From 083e0904dbd017ddbdd2174ce93697c32864dc23 Mon Sep 17 00:00:00 2001 From: PatR Date: Thu, 23 Aug 2018 18:01:00 -0700 Subject: [PATCH] another fix fox "killed, while helpless" Augmented death reason with appended "while " was broken in 3.6.0 and got fixed shortly after release (too late to prevent high-score files from being corrupted). Then within a couple of weeks it got broken again, and doesn't work in 3.6.1 either (but in this case, it is omitted instead of being cloned to all following score entries). The problem is in both record and logfile, but not xlogfile, so we could create a fix up routine that would use the last to repair record (and perhaps logfile). But having two fixup routines would probably lead to confusion. The problem this time was bad logic in the fix for |alter name of monster causing hero's death if name contains | characters that could cause confusion when using record, | logfile, or xlogfile later killerformat() was going out of bounds of the input string and using up all of 'siz' so that there was never room to append the ", while helpless" suffix. --- doc/fixes36.2 | 2 ++ src/topten.c | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/doc/fixes36.2 b/doc/fixes36.2 index 3d412d2ca..582b85c52 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -93,6 +93,8 @@ shop door repair which took place when hero was on another level only worked correctly if a trap at the same spot was removed object scattering during shop wall repair was skipped if a trap at the same spot was also being removed +augmented death reason for "while helpless" was broken for record and logfile + (but still correct for xlogfile) Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository diff --git a/src/topten.c b/src/topten.c index fbe6573cb..4652d42b2 100644 --- a/src/topten.c +++ b/src/topten.c @@ -130,7 +130,9 @@ boolean incl_helpless; */ while (--siz > 0) { c = *kname++; - if (c == ',') + if (!c) + break; + else if (c == ',') c = ';'; /* 'xlogfile' doesn't really need protection for '=', but fixrecord.awk for corrupted 3.6.0 'record' does (only -- 2.40.0