]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: peers/cli: fix "show peers" crash
authorWilly Tarreau <w@1wt.eu>
Tue, 31 May 2022 06:49:29 +0000 (08:49 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 31 May 2022 06:49:29 +0000 (08:49 +0200)
Commit d0a06d52f ("CLEANUP: applet: use applet_put*() everywhere possible")
replaced most accesses to the conn_stream with simpler accesses to the
appctx. Unfortunately, in all the CLI functions using an appctx, one
makes an exception where the appctx is not the caller's but the one being
inspected! When no peers connection is active, the early exit immediately
crashes.

No backport is needed.

src/peers.c

index da83a799960927c9c48ded2c703597c68fdab82e..6dfa35f8e41f68bcd08dd5c1ae4e7cf2fa63ee75 100644 (file)
@@ -3917,7 +3917,7 @@ static int peers_dump_peer(struct buffer *msg, struct stconn *sc, struct peer *p
 
  end:
        chunk_appendf(&trash, "\n");
-       if (applet_putchk(appctx, msg) == -1)
+       if (applet_putchk(sc_appctx(sc), msg) == -1)
                return 0;
 
        return 1;