]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
quiche: avoid NULL deref in debug logging
authorDaniel Stenberg <daniel@haxx.se>
Mon, 17 Jul 2023 18:51:17 +0000 (20:51 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 17 Jul 2023 21:27:01 +0000 (23:27 +0200)
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

index d906ebad866d53187ecfb299dfb0ada83e986509..dec97b70dbcb62d550040171bc90f188ae840b0a 100644 (file)
@@ -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;
 }