]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MEDIUM: cli: always reset the service context between commands
authorWilly Tarreau <w@1wt.eu>
Thu, 18 Aug 2022 16:04:37 +0000 (18:04 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 18 Aug 2022 16:16:36 +0000 (18:16 +0200)
commit1addf8b777c69b905591634e492893a2a9233d50
treef50f77494bf57cb896213ba04cc20b14bc266ba2
parent1cc08a33e17ca9c72204af84ecaa0c87e6d1f066
BUG/MEDIUM: cli: always reset the service context between commands

Erwan Le Goas reported that chaining certain commands on the CLI would
systematically crash the process; for example, "show version; show sess".
This happened since the conversion of cli context to appctx->svcctx,
because if applet_reserve_svcctx() is called a first time for a tiny
context, it's allocated in-situ, and later a keyword that wants a
larger one will see that it's not null and will reuse it and will
overwrite the end of the first one's context.

What is missing is a reset of the svcctx when looping back to
CLI_ST_GETREQ.

This needs to be backported to 2.6, and relies on previous commit
"MINOR: applet: add a function to reset the svcctx of an applet".
src/cli.c