From eaa8c278c88003562aaade45e223b5e656bbdba8 Mon Sep 17 00:00:00 2001 From: nhmall Date: Sat, 22 Jun 2019 00:05:16 -0400 Subject: [PATCH] code in parse_conf_file() to trim trailing blanks/cr was missing them Observed on a text file with crlf endings on Linux, where the so-called blank lines weren't being ignored as they should have been, despite there being a line to remove \r from the end. A pointer was being pre-decremented before the check for a matching whitespace character. --- doc/fixes36.3 | 1 + src/files.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/fixes36.3 b/doc/fixes36.3 index f4e36ac3a..daedd86ec 100644 --- a/doc/fixes36.3 +++ b/doc/fixes36.3 @@ -79,6 +79,7 @@ for wizard mode 'monpolycontrol', allow usually disallowed type 'chameleon', add Space, Return, and Escape to '? k' (help for menu control keys) hero can no longer negotiate a bribe with a demon lord when deaf wishing for "foo amulet" now yields an "amulet of foo" rather than random one +code in parse_conf_file() to trim trailing blanks/cr was skipping over them Fixes to Post-3.6.2 Problems that Were Exposed Via git Repository diff --git a/src/files.c b/src/files.c index 92940c9b0..29ad2f1a8 100644 --- a/src/files.c +++ b/src/files.c @@ -3051,9 +3051,9 @@ boolean FDECL((*proc), (char *)); *ep = '\0'; /* trim off spaces at end of line */ - while (--ep >= inbuf + while (ep >= inbuf && (*ep == ' ' || *ep == '\t' || *ep == '\r')) - *ep = '\0'; + *ep-- = '\0'; if (!config_error_nextline(inbuf)) { rv = FALSE;