]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MEDIUM: mcli: do not try to parse empty buffers
authorWilly Tarreau <w@1wt.eu>
Thu, 20 Jan 2022 07:31:50 +0000 (08:31 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 20 Jan 2022 17:56:57 +0000 (18:56 +0100)
commit6cd93f52e974aca4dac7aa2756c4e17659ae5354
tree31ee72884f090d93db534839ce61dcd6d02603f5
parent0f727dabf51d4ffead40fd43feb7c07193ebde99
BUG/MEDIUM: mcli: do not try to parse empty buffers

When pcli_parse_request() is called with an empty buffer, it still tries
to parse it and can go on believing it finds an empty request if the last
char before the beginning of the buffer is a '\n'. In this case it overwrites
it with a zero and processes it as an empty command, doing nothing but not
making the buffer progress. This results in an infinite loop that is stopped
by the watchdog. For a reason related to another issue (yet to be fixed),
this can easily be reproduced by pipelining lots of commands such as
"show version".

Let's add a length check after the search for a '\n'.

This needs to be backported as far as 2.0.
src/cli.c