]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
vtls_scache: fix possible null ptr deref
authorDaniel Stenberg <daniel@haxx.se>
Thu, 9 Jan 2025 07:31:32 +0000 (08:31 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 9 Jan 2025 16:25:48 +0000 (17:25 +0100)
Pointed out by CodeSonar. It is probably not reachable, but might as
well just add a precaution.

Closes #15950

lib/vtls/vtls_scache.c

index 937cb8c87ec0e235c17997d1097ec2a3cfa54bf8..9c04b7762300c88699ad977301ea7c238ee1d1a9 100644 (file)
@@ -783,7 +783,7 @@ out:
                   "quic_tp=%s], peer has %zu sessions now",
                   ssl_peer_key, s->ietf_tls_id, s->valid_until - now,
                   s->alpn, s->earlydata_max, s->quic_tp ? "yes" : "no",
-                  Curl_llist_count(&peer->sessions));
+                  peer ? Curl_llist_count(&peer->sessions) : 0);
   return result;
 }