]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MINOR: cfgparse: report extraneous args *after* the string is allocated
authorWilly Tarreau <w@1wt.eu>
Thu, 25 Jun 2020 05:41:22 +0000 (07:41 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 25 Jun 2020 07:43:27 +0000 (09:43 +0200)
commit07d47060e0d99d0884440c3fa55ef2a338987769
treed80bf9a52719f7c205bbaf12a853ec19c6b52e60
parent61dd44bbc1d7b98710ddd922b766170e55defe73
BUG/MINOR: cfgparse: report extraneous args *after* the string is allocated

The config parser change in commit 9e1758efb ("BUG/MEDIUM: cfgparse: use
parse_line() to expand/unquote/unescape config lines") is wrong when
displaying the last parsed word, because it doesn't verify that the output
string was properly allocated. This may fail in two cases:
  - very first line (outline is NULL, as in oss-fuzz issue 23657)
  - much longer line than previous ones, requiring a realloc(), in which
    case the final 0 is out of the allocated space.

This patch moves the reporting after the allocation check to fix this.

No backport is needed, this is 2.2 only.
src/cfgparse.c