From: Matt Caswell <matt@openssl.org>
Date: Wed, 2 Nov 2016 11:15:08 +0000 (+0000)
Subject: Ensure that vent->smeth != NULL before we call vent->smeth()
X-Git-Tag: OpenSSL_1_1_1-pre1~3125
X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=bf85ef1b60d03c76e85ec06be3999ead4533f092;p=oweals%2Fopenssl.git

Ensure that vent->smeth != NULL before we call vent->smeth()

We can end up with a NULL SSL_METHOD function if a method has been
disabled. If that happens then we shouldn't call vent->smeth().

Reviewed-by: Rich Salz <rsalz@openssl.org>
---

diff --git a/ssl/statem/statem_lib.c b/ssl/statem/statem_lib.c
index 2aadc77a77..c05f645d87 100644
--- a/ssl/statem/statem_lib.c
+++ b/ssl/statem/statem_lib.c
@@ -1053,7 +1053,7 @@ int ssl_choose_server_version(SSL *s, CLIENTHELLO_MSG *hello)
                  vent->version != 0 && vent->version != (int)candidate_vers;
                  ++vent)
                 ;
-            if (vent->version != 0) {
+            if (vent->version != 0 && vent->smeth != NULL) {
                 const SSL_METHOD *method;
 
                 method = vent->smeth();