From a19b759dea7c2e58f28f2ce3ec7d321299328c5b Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 9 Jan 2025 08:31:32 +0100 Subject: [PATCH] vtls_scache: fix possible null ptr deref Pointed out by CodeSonar. It is probably not reachable, but might as well just add a precaution. Closes #15950 --- lib/vtls/vtls_scache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/vtls/vtls_scache.c b/lib/vtls/vtls_scache.c index 937cb8c87e..9c04b77623 100644 --- a/lib/vtls/vtls_scache.c +++ b/lib/vtls/vtls_scache.c @@ -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; }