]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: quic: Possible NULL pointer dereferencing when dumping streams.
authorFrédéric Lécaille <flecaille@haproxy.com>
Mon, 11 Jan 2021 14:10:06 +0000 (15:10 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 23 Sep 2021 13:27:25 +0000 (15:27 +0200)
This bug may occur when displaying streams traces. It came with this commit:
242fb1b63 ("MINOR: quic: Drop packets with STREAM frames with wrong direction.").

src/xprt_quic.c

index e4609d34131fd68cd5cb45b3241929c6439ee0f6..1c8e9de851cb9e353ec40ec1c048a1e60057fccc 100644 (file)
@@ -574,14 +574,17 @@ static void quic_trace(enum trace_level level, uint64_t mask, const struct trace
 
                if (mask & QUIC_EV_CONN_PSTRM) {
                        const struct quic_frame *frm = a2;
-                       const struct quic_stream *s = &frm->stream;
-
-                       chunk_appendf(&trace_buf, " uni=%d fin=%d id=%llu off=%llu len=%llu",
-                                     !!(s->id & QUIC_STREAM_FRAME_ID_DIR_BIT),
-                                     !!(frm->type & QUIC_STREAM_FRAME_TYPE_FIN_BIT),
-                                     (unsigned long long)s->id,
-                                     (unsigned long long)s->offset,
-                                     (unsigned long long)s->len);
+
+                       if (a2) {
+                               const struct quic_stream *s = &frm->stream;
+
+                               chunk_appendf(&trace_buf, " uni=%d fin=%d id=%llu off=%llu len=%llu",
+                                                         !!(s->id & QUIC_STREAM_FRAME_ID_DIR_BIT),
+                                                         !!(frm->type & QUIC_STREAM_FRAME_TYPE_FIN_BIT),
+                                                         (unsigned long long)s->id,
+                                                         (unsigned long long)s->offset,
+                                                         (unsigned long long)s->len);
+                       }
                }
        }
        if (mask & QUIC_EV_CONN_LPKT) {