]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Add NULL check in ossl_quic_get_peer_token
authorNeil Horman <nhorman@openssl.org>
Tue, 13 May 2025 14:48:05 +0000 (10:48 -0400)
committerNeil Horman <nhorman@openssl.org>
Thu, 15 May 2025 13:04:02 +0000 (09:04 -0400)
If a peer address hasn't been set on a quic channel yet, we will not
yield a token from our hashtable of available tokens.  Fail the
get_peer_token lookup in that event

Fixes #27608

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27610)

(cherry picked from commit 99ea6b38430dc977ba63c832694cdb3c2cb3c2c9)

ssl/quic/quic_impl.c

index 64da2be4afcd2d3ff91b5f08365d6b0af6613ad7..5ad5a79157f427abc0b15f4d427efdac39c9fbc2 100644 (file)
@@ -4893,6 +4893,9 @@ int ossl_quic_get_peer_token(SSL_CTX *ctx, BIO_ADDR *peer,
         return 0;
 
     key = ossl_quic_build_new_token(peer, NULL, 0);
+    if (key == NULL)
+        return 0;
+
     ossl_crypto_mutex_lock(c->mutex);
     tok = lh_QUIC_TOKEN_retrieve(c->cache, key);
     if (tok != NULL) {