]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
ssl/ech/ech_internal.c: avoid NULL dereference in ossl_ech_get_ch_offsets
authorEugene Syromiatnikov <esyr@openssl.org>
Mon, 23 Feb 2026 04:29:37 +0000 (05:29 +0100)
committerTomas Mraz <tomas@openssl.org>
Wed, 25 Feb 2026 11:10:24 +0000 (12:10 +0100)
Do not call SSLfatal with s that can potentially be NULL.

Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1681455
Fixes: 6c3edd4f3a8a "Add server-side handling of Encrypted Client Hello"
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:47 2026
(Merged from https://github.com/openssl/openssl/pull/30139)

ssl/ech/ech_internal.c

index bda806f2d307ed68e63706e75de48be4eb8ee5b6..cb9b846e3f1bc100298c1de7d743c802aaa11e06 100644 (file)
@@ -1132,7 +1132,9 @@ int ossl_ech_get_ch_offsets(SSL_CONNECTION *s, PACKET *pkt, size_t *sessid_off,
     const unsigned char *ch = NULL;
     size_t ch_len = 0, exts_len = 0, sni_len = 0, ech_len = 0;
 
-    if (s == NULL || pkt == NULL || sessid_off == NULL || exts_off == NULL
+    if (s == NULL)
+        return 0;
+    if (pkt == NULL || sessid_off == NULL || exts_off == NULL
         || ech_off == NULL || echtype == NULL || inner == NULL
         || sni_off == NULL) {
         SSLfatal(s, SSL_AD_DECODE_ERROR, SSL_R_BAD_EXTENSION);