check the return value of OSSL_PARAM_BLD_new in dsa_kmgmt.c:195
authorx2018 <xkernel.wang@foxmail.com>
Mon, 29 Nov 2021 11:08:36 +0000 (19:08 +0800)
committerTomas Mraz <tomas@openssl.org>
Wed, 5 Jan 2022 09:17:26 +0000 (10:17 +0100)
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17155)

providers/implementations/keymgmt/dsa_kmgmt.c

index 1e1b168f7d20052754890bd54f42eb53a3960b02..b327a3a783d94f78301bfcf92073f9bf232c426f 100644 (file)
@@ -210,12 +210,16 @@ static int dsa_export(void *keydata, int selection, OSSL_CALLBACK *param_cb,
                       void *cbarg)
 {
     DSA *dsa = keydata;
-    OSSL_PARAM_BLD *tmpl = OSSL_PARAM_BLD_new();
+    OSSL_PARAM_BLD *tmpl;
     OSSL_PARAM *params = NULL;
     int ok = 1;
 
     if (!ossl_prov_is_running() || dsa == NULL)
-        goto err;
+        return 0;
+
+    tmpl = OSSL_PARAM_BLD_new();
+    if (tmpl == NULL)
+        return 0;
 
     if ((selection & OSSL_KEYMGMT_SELECT_ALL_PARAMETERS) != 0)
         ok = ok && ossl_ffc_params_todata(ossl_dsa_get0_params(dsa), tmpl, NULL);