]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MEDIUM: cli: Fix parsing of pattern finishing a command payload
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 22 May 2026 15:10:28 +0000 (17:10 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 22 May 2026 15:17:01 +0000 (17:17 +0200)
commit41bb1c24f6eff46ce9cf83c1b64963056506bf95
tree6c778aeba443c2f21041459d1983b591299fbad7
parent9091cfa617a4f593785b6093548dff70a07b1e0f
BUG/MEDIUM: cli: Fix parsing of pattern finishing a command payload

When the dedidacted buffer to store the command payload was added (c5ae0da62
"MEDIUM: cli: Make a buffer for the command payload"), an bug was
introduced. When the pattern finishing the command payload is found, it is
removed from the buffer. A NULL-bytes is added before it, skipping the
previous newline character.

It worked well in all cases before the commit above, because the commandline
was already parsed and was placed at the beginning of the cmdline buffer.
So, there is always a line before the payload.

Now, the payload is stored in a dedicated buffer. So there is nothing
preceeding it in a buffer. If the payload is empty, we cannot rewind to the
previous line to set the NULL-byte character. We must handle this case to
avoid integer underflow on the payload buffer length.

It is a 3.4-specific bug. No backport needed.
src/cli.c