summaryrefslogtreecommitdiffstats
path: root/ssl
diff options
context:
space:
mode:
authoratishkov <a.tishkov@aladdin.ru>2023-10-24 12:30:22 +0300
committerHugo Landau <hlandau@openssl.org>2023-10-26 15:45:03 +0100
commit6f1d3e130ed9f79335e5c9bd518f835b71417564 (patch)
treec5aa274baf63f8f178e05b843807009651688bdc /ssl
parent54fa5b3911ead0e1ba7d32bc5732ed2a60b38a99 (diff)
ssl_lib: added pointer SSL and SSL_CONNECTION check to NULL before dereferencing it in ossl_ctrl_internal()
Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22470) (cherry picked from commit b9788ce6a869185f040df4c98d2e7143110aa517)
Diffstat (limited to 'ssl')
-rw-r--r--ssl/ssl_lib.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c
index 5314e1ec0d..e010bb7e30 100644
--- a/ssl/ssl_lib.c
+++ b/ssl/ssl_lib.c
@@ -2906,9 +2906,8 @@ 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 (sc == NULL)
+ if (s == NULL)
return 0;
/*
@@ -2929,6 +2928,11 @@ 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);