When fgets() returns an incomplete line we must not increment linenum
otherwise line numbers become incorrect. This may happen when parsing
files with extremely long lines which require a realloc().
The bug has been present since unbounded line length was supported, so
the fix should be backported to older branches.
file, linenum);
err_code |= ERR_ALERT | ERR_FATAL;
fatal++;
+ linenum--;
continue;
}
readbytes = linesize - 1;
linesize = newlinesize;
thisline = newline;
+ linenum--;
continue;
}