]> git.kaiwu.me - haproxy.git/commit
BUG/MEDIUM: cli: Don't parse next command if input buffer is empty
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 11 Sep 2026 07:51:11 +0000 (09:51 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 11 Sep 2026 09:38:27 +0000 (11:38 +0200)
commit42aec4151b61d42ef39fd0b808c88245e452c03c
tree03f4196f0c57e51f836edaf2928f6268e4ea4b30
parentb54c7a8237f3dbfb285916a48b8335727300d5df
BUG/MEDIUM: cli: Don't parse next command if input buffer is empty

In the loop of the command line parser, we always tried to get the next
command, even when the input buffer was empty. However it was an issue if
the size of command line was exactly the buffer size and it was finished by
a payload pattern. In that case, an attempt to allocate a dynamic buffer for
the payload was performed with a size of 0, which led to a crash.

To fix the issue, the loop is now interrupted with there is no more data to
parse in the input buffer. This way, when an dynamic buffer must be
(re)allocated, we are sure its size will never be 0. To be sure it is true,
a BUG_ON() was added on the new dynamic buffer size.

To mitigate the issue, "tune.cli.max-payload-size" parameter can be set to
0.

This patch must be backported to 3.4.
src/cli.c