diff --git a/src/cfgparse.c b/src/cfgparse.c index f0d690b2e..a1d2428a2 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -3697,6 +3697,21 @@ int readcfgfile(const char *file) if (!**args) continue; + if (*line) { + /* we had to stop due to too many args. + * Let's terminate the string, print the offending part then cut the + * last arg. + */ + while (*line && *line != '#' && *line != '\n' && *line != '\r') + line++; + *line = '\0'; + + Alert("parsing [%s:%d]: line too long, truncating at word %d, position %d : <%s>.\n", + file, linenum, arg + 1, args[arg] - thisline + 1, args[arg]); + err_code |= ERR_ALERT | ERR_FATAL; + args[arg] = line; + } + /* zero out remaining args and ensure that at least one entry * is zeroed out. */