Skip to content

Commit

Permalink
ssl_lib: added pointer SSL_CONNECTION check to NULL before dereferenc…
Browse files Browse the repository at this point in the history
…ing 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 #22470)
  • Loading branch information
atishkov authored and hlandau committed Oct 26, 2023
1 parent b419fcc commit 8dc82c0
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions ssl/ssl_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/*
Expand All @@ -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);
Expand Down

0 comments on commit 8dc82c0

Please sign in to comment.