From: Matt Caswell Date: Mon, 9 Nov 2015 16:37:33 +0000 (+0000) Subject: Remove redundant check from tls1_get_curvelist X-Git-Tag: OpenSSL_1_1_0-pre1~291 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6329b6092b28b656be8a1e4a8363d2e3bcc32053;p=openssl Remove redundant check from tls1_get_curvelist The function tls1_get_curvelist() has an explicit check to see if s->cert is NULL or not. However the check appears *after* calling the tls1_suiteb macro which derefs s->cert. In reality s->cert can never be NULL because it is created in SSL_new(). If the malloc fails then the SSL_new call fails and no SSL object is created. Reviewed-by: Tim Hudson --- diff --git a/ssl/t1_lib.c b/ssl/t1_lib.c index 9607c2e02a..943d4733f4 100644 --- a/ssl/t1_lib.c +++ b/ssl/t1_lib.c @@ -441,7 +441,7 @@ static int tls1_get_curvelist(SSL *s, int sess, pcurveslen = s->tlsext_ellipticcurvelist_length; } if (!*pcurves) { - if (!s->server || (s->cert && s->cert->ecdh_tmp_auto)) { + if (!s->server || s->cert->ecdh_tmp_auto) { *pcurves = eccurves_auto; pcurveslen = sizeof(eccurves_auto); } else {