From: Willy Tarreau Date: Mon, 4 Sep 2023 13:30:33 +0000 (+0200) Subject: BUG/MINOR: stream: further protect stream_dump() against incomplete sessions X-Git-Tag: v2.9-dev5~65 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8547f5cfa272d4483e8ad9fc4e21d87f22022c92;p=thirdparty%2Fhaproxy.git 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. --- diff --git a/src/stream.c b/src/stream.c index e23cebb899..00a6c07b78 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,