]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
NULL check needs to be moved before using strchr (#4115)
authorAlejandro Perez <alex.perez-mendez@jisc.ac.uk>
Wed, 16 Jun 2021 11:54:19 +0000 (13:54 +0200)
committerGitHub <noreply@github.com>
Wed, 16 Jun 2021 11:54:19 +0000 (06:54 -0500)
src/main/tls.c

index e032c408e0c1d3911ccaad7b81ceffce9fc82d4c..e0128c9fcb8ebff35de9ed9ef774d2b250bc4f9e 100644 (file)
@@ -3288,6 +3288,8 @@ static int set_ecdh_curve(SSL_CTX *ctx, char const *ecdh_curve, bool disable_sin
                SSL_CTX_set_options(ctx, SSL_OP_SINGLE_ECDH_USE);
        }
 
+       if (!ecdh_curve || !*ecdh_curve) return 0;
+
 #if OPENSSL_VERSION_NUMBER >= 0x0100200fL
        if (strchr(ecdh_curve, ':') != 0) {
                char *list = strdup(ecdh_curve);
@@ -3311,8 +3313,6 @@ static int set_ecdh_curve(SSL_CTX *ctx, char const *ecdh_curve, bool disable_sin
        }
 #endif
 
-       if (!ecdh_curve || !*ecdh_curve) return 0;
-
        nid = OBJ_sn2nid(ecdh_curve);
        if (!nid) {
                ERROR(LOG_PREFIX ": Unknown ecdh_curve \"%s\"", ecdh_curve);