]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: stream: further protect stream_dump() against incomplete sessions
authorWilly Tarreau <w@1wt.eu>
Mon, 4 Sep 2023 13:30:33 +0000 (15:30 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 4 Sep 2023 13:32:17 +0000 (15:32 +0200)
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

index e23cebb899ba00c706bbb46e64ef5976802bcf3f..00a6c07b7826dc707cbd87237d4ee69256434f8a 100644 (file)
@@ -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,