From 8547f5cfa272d4483e8ad9fc4e21d87f22022c92 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Mon, 4 Sep 2023 15:30:33 +0200 Subject: [PATCH] BUG/MINOR: stream: further protect stream_dump() against incomplete sessions As found by Coverity in issue #2273, the fix in commit e64bccab2 ("BUG/MINOR: stream: protect stream_dump() against incomplete streams") was still not enough, as scf/scb are still dereferenced to dump their flags and states. This should be backported to 2.8. --- src/stream.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/stream.c b/src/stream.c index e23cebb89..00a6c07b7 100644 --- a/src/stream.c +++ b/src/stream.c @@ -2861,7 +2861,8 @@ void stream_dump(struct buffer *buf, const struct stream *s, const char *pfx, ch (s->txn ? h1_msg_state_str(s->txn->req.msg_state): "-"), (s->txn ? s->txn->req.flags : 0), (s->txn ? h1_msg_state_str(s->txn->rsp.msg_state): "-"), (s->txn ? s->txn->rsp.flags : 0), eol, pfx, req->flags, req->analysers, res->flags, res->analysers, eol, - pfx, scf, sc_state_str(scf->state), scf->flags, scb, sc_state_str(scb->state), scb->flags, eol, + pfx, scf, scf ? sc_state_str(scf->state) : 0, scf ? scf->flags : 0, + scb, scb ? sc_state_str(scb->state) : 0, scb ? scb->flags : 0, eol, pfx, acf, acf ? acf->st0 : 0, acb, acb ? acb->st0 : 0, eol, pfx, cof, cof ? cof->flags : 0, conn_get_mux_name(cof), cof?cof->ctx:0, conn_get_xprt_name(cof), cof ? cof->xprt_ctx : 0, conn_get_ctrl_name(cof), conn_fd(cof), eol,