From 39b352321e40d267678d02d13ab6de1e1e4958c6 Mon Sep 17 00:00:00 2001 From: Jonathan McDowell Date: Wed, 15 Dec 2004 15:27:44 +0000 Subject: [PATCH] Fix parsing of empty config file lines. Fred Strauss reported a problem with parsing empty lines in the config file; we weren't checking if the line was empty before stripping trailing white space. We do now. --- onak-conf.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/onak-conf.c b/onak-conf.c index 81d7bdf..f97197c 100644 --- a/onak-conf.c +++ b/onak-conf.c @@ -60,9 +60,11 @@ void readconfig(const char *configfile) { fgets(curline, 1023, conffile); while (!feof(conffile)) { - for (i = strlen(curline) - 1; isspace(curline[i]); i--) { - curline[i] = 0; - } + for (i = strlen(curline) - 1; + i >= 0 && isspace(curline[i]); + i--) { + curline[i] = 0; + } if (curline[0] == '#' || curline[0] == 0) { /* -- 2.39.2