libbb/parse_config.c: fix small buglet (by Vladimir)

This commit is contained in:
Denis Vlasenko
2008-07-20 17:50:58 +00:00
parent a34f1ed737
commit 9b366f4136
2 changed files with 45 additions and 2 deletions

View File

@ -199,7 +199,8 @@ int FAST_FUNC config_read(parser_t *parser, char **tokens, unsigned flags, const
} else {
// vanilla token. cut the line at the first delim
q = line + strcspn(line, delims);
*q++ = '\0';
if (*q) // watch out: do not step past the line end!
*q++ = '\0';
}
// pin token
if ((flags & (PARSE_DONT_REDUCE|PARSE_DONT_TRIM)) || *line) {
@ -207,6 +208,7 @@ int FAST_FUNC config_read(parser_t *parser, char **tokens, unsigned flags, const
tokens[ii++] = line;
}
line = q;
//bb_info_msg("A[%s]", line);
}
if (ii < mintokens)