From: Dr. Stephen Henson Date: Tue, 19 Jul 2016 15:03:10 +0000 (+0100) Subject: Sanity check in ssl_get_algorithm2(). X-Git-Tag: OpenSSL_1_1_0-pre6~146 X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=commitdiff_plain;h=52eede5a970fdb30c4ed6d3663e51f36bd1b1c73 Sanity check in ssl_get_algorithm2(). RT#4600 Reviewed-by: Rich Salz --- diff --git a/ssl/s3_lib.c b/ssl/s3_lib.c index 8218c2fa74..9158f21b96 100644 --- a/ssl/s3_lib.c +++ b/ssl/s3_lib.c @@ -3882,7 +3882,10 @@ int ssl3_renegotiate_check(SSL *s) */ long ssl_get_algorithm2(SSL *s) { - long alg2 = s->s3->tmp.new_cipher->algorithm2; + long alg2; + if (s->s3 == NULL || s->s3->tmp.new_cipher == NULL) + return -1; + alg2 = s->s3->tmp.new_cipher->algorithm2; if (s->method->ssl3_enc->enc_flags & SSL_ENC_FLAG_SHA256_PRF) { if (alg2 == (SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF)) return SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256;