From: Willy Tarreau Date: Wed, 1 Jul 2020 05:09:39 +0000 (+0200) Subject: BUG/MINOR: proxy: always initialize the trash in show servers state X-Git-Tag: v2.1.8~51 X-Git-Url: http://git.haproxy.org/?a=commitdiff_plain;h=1d4153fad4f82b8b771422a92a9795a2ac46f6a4;p=haproxy-2.1.git BUG/MINOR: proxy: always initialize the trash in show servers state Actually the cleanup in commit 6ff8143f7 ("BUG/MINOR: proxy: fix dump_server_state()'s misuse of the trash") allowed to spot that the trash is never reset when dumping a servers state. I couldn't manage to make it dump garbage even with large setups but didn't find either where it's cleared between successive calls while other handlers do explicitly invoke chunk_reset(), so it seems to happen a bit by luck. Let's use chunk_printf() here for each turn, it makes things clearer. This could be backported along with previous patch, especially if any user reports occasional garbage appearing in the show servers output. (cherry picked from commit df2a0305f24a58f56d44e1d12ea247a5ff243757) Signed-off-by: Christopher Faulet --- diff --git a/src/proxy.c b/src/proxy.c index a459f9c..df4668e 100644 --- a/src/proxy.c +++ b/src/proxy.c @@ -1801,7 +1801,7 @@ static int dump_servers_state(struct stream_interface *si) if (srv->srvrq && srv->srvrq->name) srvrecord = srv->srvrq->name; - chunk_appendf(&trash, + chunk_printf(&trash, "%d %s " "%d %s %s " "%d %d %d %d %ld "