From: atishkov Date: Tue, 24 Oct 2023 11:59:00 +0000 (+0300) Subject: ssl_lib: added pointer SSL_CONNECTION check to NULL before dereferencing it in ossl_c... X-Git-Tag: openssl-3.3.0-alpha1~766 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8dc82c02559545fabe15fd95d55623f4f7fc0f08;p=thirdparty%2Fopenssl.git ssl_lib: added pointer SSL_CONNECTION check to NULL before dereferencing it in ossl_ctrl_internal() Reviewed-by: Tomas Mraz Reviewed-by: Paul Dale Reviewed-by: Hugo Landau (Merged from https://github.com/openssl/openssl/pull/22470) --- diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c index d2394ee0dbe..5314e1ec0dc 100644 --- a/ssl/ssl_lib.c +++ b/ssl/ssl_lib.c @@ -2906,8 +2906,9 @@ long SSL_ctrl(SSL *s, int cmd, long larg, void *parg) long ossl_ctrl_internal(SSL *s, int cmd, long larg, void *parg, int no_quic) { long l; + SSL_CONNECTION *sc = SSL_CONNECTION_FROM_SSL(s); - if (s == NULL) + if (sc == NULL) return 0; /* @@ -2928,11 +2929,6 @@ long ossl_ctrl_internal(SSL *s, int cmd, long larg, void *parg, int no_quic) if (!no_quic && IS_QUIC(s)) return s->method->ssl_ctrl(s, cmd, larg, parg); - SSL_CONNECTION *sc = SSL_CONNECTION_FROM_SSL(s); - - if (sc == NULL) - return 0; - switch (cmd) { case SSL_CTRL_GET_READ_AHEAD: return RECORD_LAYER_get_read_ahead(&sc->rlayer);