]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
check the return value of OPENSSL_strdup to prevent potential memory access error
authorx2018 <xkernel.wang@foxmail.com>
Tue, 23 Nov 2021 11:25:43 +0000 (19:25 +0800)
committerPauli <ppzgs1@gmail.com>
Thu, 25 Nov 2021 00:34:15 +0000 (10:34 +1000)
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17110)

apps/lib/engine_loader.c

index 7ea05943f380d08b7758592af961334de81f84e2..aa1bad26a4b8a54821eed24f9b7fb533c2b9c083 100644 (file)
@@ -89,7 +89,7 @@ static OSSL_STORE_LOADER_CTX *engine_open(const OSSL_STORE_LOADER *loader,
         keyid = OPENSSL_strdup(q + 1);
     }
 
-    if (e != NULL)
+    if (e != NULL && keyid != NULL)
         ctx = OSSL_STORE_LOADER_CTX_new(e, keyid);
 
     if (ctx == NULL) {