From: Jonathan McDowell Date: Wed, 15 Dec 2004 15:27:44 +0000 (+0000) Subject: Fix parsing of empty config file lines. X-Git-Url: https://git.sommitrealweird.co.uk/onak.git/commitdiff_plain/39b352321e40d267678d02d13ab6de1e1e4958c6?ds=sidebyside 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) { /*