From a141c3c08b1bb8db6b51ae00d47898416c48efd9 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 17 Jul 2023 20:51:17 +0200 Subject: [PATCH] quiche: avoid NULL deref in debug logging Coverity reported "Dereference after null check" If stream is NULL and the function exits, the logging must not deref it. Closes #11454 --- lib/vquic/curl_quiche.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/vquic/curl_quiche.c b/lib/vquic/curl_quiche.c index d906ebad86..dec97b70db 100644 --- a/lib/vquic/curl_quiche.c +++ b/lib/vquic/curl_quiche.c @@ -884,8 +884,9 @@ out: if(nread > 0) ctx->data_recvd += nread; DEBUGF(LOG_CF(data, cf, "[h3sid=%"PRId64"] cf_recv(total=%" - CURL_FORMAT_CURL_OFF_T ") -> %zd, %d", - stream->id, ctx->data_recvd, nread, *err)); + CURL_FORMAT_CURL_OFF_T ") -> %zd, %d", + stream ? stream->id : (int64_t)0, + ctx->data_recvd, nread, *err)); return nread; } -- 2.47.3