BUG/MINOR: quic: Possible NULL pointer dereferencing when dumping streams.
This bug may occur when displaying streams traces. It came with this commit:
242fb1b63 ("MINOR: quic: Drop packets with STREAM frames with wrong direction.").
diff --git a/src/xprt_quic.c b/src/xprt_quic.c
index e4609d3..1c8e9de 100644
--- a/src/xprt_quic.c
+++ b/src/xprt_quic.c
@@ -574,14 +574,17 @@
if (mask & QUIC_EV_CONN_PSTRM) {
const struct quic_frame *frm = a2;
- const struct quic_stream *s = &frm->stream;
+
+ 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);
+ 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) {