]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
ssl/ech/ech_store.c: avoid NULL dereference in ech_decode_one_entry()
authorEugene Syromiatnikov <esyr@openssl.org>
Mon, 23 Feb 2026 04:52:44 +0000 (05:52 +0100)
committerTomas Mraz <tomas@openssl.org>
Wed, 25 Feb 2026 11:10:24 +0000 (12:10 +0100)
Do not jump to the err label on rent NULL check failure (where
it is dereferenced) and rather return immediately.

Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1681462
Fixes: 4af71a77387c "ECH CLI implementation"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Wed Feb 25 11:10:52 2026
(Merged from https://github.com/openssl/openssl/pull/30139)

ssl/ech/ech_store.c

index c5963347f3382ea00f1ecb650371e63a6b6cbc1c..5c9021727113b521bfc44a243dd1ec30af6f9ff9 100644 (file)
@@ -311,7 +311,11 @@ static int ech_decode_one_entry(OSSL_ECHSTORE_ENTRY **rent, PACKET *pkt,
     unsigned char test_pub[OSSL_ECH_CRYPTO_VAR_SIZE];
     OSSL_ECHSTORE_ENTRY *ee = NULL;
 
-    if (rent == NULL || pkt == NULL) {
+    if (rent == NULL) {
+        ERR_raise(ERR_LIB_SSL, ERR_R_INTERNAL_ERROR);
+        return 0;
+    }
+    if (pkt == NULL) {
         ERR_raise(ERR_LIB_SSL, ERR_R_INTERNAL_ERROR);
         goto err;
     }