BUG/MINOR: cfgparse: don't increment linenum on incomplete lines
authorWilly Tarreau <w@1wt.eu>
Thu, 25 Jun 2020 07:37:54 +0000 (09:37 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 21 Jul 2020 16:32:48 +0000 (18:32 +0200)
commit2c0f0d2aab145b098a045f28d2acdb12b9d2033f
tree44b5aee0737a1abd29618d03fc8f1561cfb3d5fb
parentb35a82ba015aa347209a0285320608fcc71a9690
BUG/MINOR: cfgparse: don't increment linenum on incomplete lines

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.

(cherry picked from commit 40cb26f6ec8cf9d8ba54706d95df4cfed3a7b332)
[wt: adjusted context wrt missing fatal++]
Signed-off-by: Willy Tarreau <w@1wt.eu>
src/cfgparse.c