]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
mod_ssl: Check SSL_CTX_new() return value
authorJoe Orton <jorton@apache.org>
Thu, 29 Feb 2024 13:35:04 +0000 (13:35 +0000)
committerJoe Orton <jorton@apache.org>
Thu, 29 Feb 2024 13:35:04 +0000 (13:35 +0000)
SSL_CTX_new() will return NULL if there was an error creating a new SSL context.

Submitted by: StephenWall
Github: closes #402

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1916054 13f79535-47bb-0310-9956-ffa450edef68

modules/ssl/ssl_engine_init.c

index 30fd6c5e4b50b9c6bfb796dae3e9a90a4686c127..64e4aaf1dcdda54fe0d770c294d3ddc495c1b9c5 100644 (file)
@@ -738,6 +738,11 @@ static apr_status_t ssl_init_ctx_protocol(server_rec *s,
         TLS_server_method();  /* server */
 #endif
     ctx = SSL_CTX_new(method);
+    if (ctx == NULL) {
+        /* Can fail for some system/install mis-configuration. */
+        ssl_log_ssl_error(SSLLOG_MARK, APLOG_EMERG, s);
+        return ssl_die(s);
+    }
 
     mctx->ssl_ctx = ctx;