From: Jonathan McDowell Date: Wed, 15 Dec 2004 15:27:44 +0000 (+0000) Subject: Fix parsing of empty config file lines. X-Git-Tag: 0.3.2~4 X-Git-Url: https://the.earth.li/gitweb/?a=commitdiff_plain;h=39b352321e40d267678d02d13ab6de1e1e4958c6;p=onak.git 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. --- 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) { /*