From 81b8e5450e2aee2a35a1913e3e051e4c4cd22ece Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Mon, 7 Jan 2008 15:27:26 +0000 Subject: Really fix off by one error. --- src/librc/librc-misc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/librc/librc-misc.c b/src/librc/librc-misc.c index afd078dd..f77b2f78 100644 --- a/src/librc/librc-misc.c +++ b/src/librc/librc-misc.c @@ -121,10 +121,10 @@ char *rc_getline (FILE *fp) p = line + last; fgets (p, BUFSIZ, fp); last += strlen (p); - } while (! feof (fp) && line[last] != '\n'); + } while (! feof (fp) && line[last - 1] != '\n'); /* Trim the trailing newline */ - if (line[last] == '\n') + if (line[--last] == '\n') line[last] = '\0'; return (line); -- cgit v1.2.3