]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
ssl/ssl_lib.c: Avoid crash when SSL_CONNECTION is NULL
authorGraham Leggett <minfrin@sharp.fm>
Wed, 2 Apr 2025 11:08:11 +0000 (12:08 +0100)
committerMatt Caswell <matt@openssl.org>
Mon, 14 Apr 2025 14:39:33 +0000 (15:39 +0100)
Detection for sc == NULL is performed after sc is used. Add the
check to the correct place.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Paul Yang <kaishen.yy@antfin.com>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/27241)

(cherry picked from commit 7f6cc862c69800a72c49fcfe89e2931ee4ca2e7a)

ssl/ssl_lib.c

index f5ec7580b84b2842c6da456a44626ab4181c2b9e..9506f74ec37daa23576afb87799bf5521cac63c3 100644 (file)
@@ -4735,6 +4735,9 @@ int SSL_do_handshake(SSL *s)
         return ossl_quic_do_handshake(s);
 #endif
 
+    if (sc == NULL)
+        return -1;
+
     if (sc->handshake_func == NULL) {
         ERR_raise(ERR_LIB_SSL, SSL_R_CONNECTION_TYPE_NOT_SET);
         return -1;