]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MINOR: stats: fix segfault caused by uninitialized value in "show schema json"
authorAurelien DARRAGON <adarragon@haproxy.com>
Mon, 23 Dec 2024 08:35:15 +0000 (09:35 +0100)
committerAurelien DARRAGON <adarragon@haproxy.com>
Mon, 23 Dec 2024 16:32:07 +0000 (17:32 +0100)
commitac1f413590932d4eb3b78ca5a536845f162b7866
tree6423fc8cf3b8313c038c6bb4de309205813f32a4
parentdfc403f5c685aa2b685f2bf87041e13655a5d8ef
BUG/MINOR: stats: fix segfault caused by uninitialized value in "show schema json"

Since b3d5708 ("MINOR: stats: remove implicit static trash_chunk usage")
a segfault can occur when issuing "show schema json" on the stats socket.

Indeed, now the dumping functions don't rely on trash_chunk anymore, but
instead they rely on the appctx->chunk buffer. However, unlike other
stats dumping commands, the "show schema json" only have an io handler,
and no parse function. With other command, the parse function is
responsible for pre-setting some data, including applet ctx reservation.

Thus due to "show schema json" lacking parsing function, the applet ctx is
used uninitialized, which is a bug obviously.

To fix the issue we simply add a parse function for "show schema json",
although all it does for now is calling applet_reserve_svcctx() for the
current applet ctx.

This issue was reported by @dsuch in GH #2825. It must be backported up
to 3.0.
src/stats.c