From: Alejandro Perez Date: Wed, 16 Jun 2021 11:54:19 +0000 (+0200) Subject: NULL check needs to be moved before using strchr (#4115) X-Git-Tag: release_3_0_24~203 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bccb0c9c0ebfb9879363073384592c6fa1f3438f;p=thirdparty%2Ffreeradius-server.git NULL check needs to be moved before using strchr (#4115) --- diff --git a/src/main/tls.c b/src/main/tls.c index e032c408e0c..e0128c9fcb8 100644 --- a/src/main/tls.c +++ b/src/main/tls.c @@ -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);