]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
kdf objects missing a return if malloc fails.
authorslontis <shane.lontis@oracle.com>
Thu, 23 Jun 2022 03:10:55 +0000 (13:10 +1000)
committerHugo Landau <hlandau@openssl.org>
Tue, 28 Jun 2022 18:48:36 +0000 (19:48 +0100)
I have searched through all references of ERR_R_MALLOC_FAILURE for any
other instances..

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18638)

providers/implementations/kdfs/tls1_prf.c
providers/implementations/kdfs/x942kdf.c

index 96eab4ea41cdc209b75d689bc845e3958140e596..fd46283d3a7ccdb02011827ed203ac4dbb0c7e88 100644 (file)
@@ -103,8 +103,10 @@ static void *kdf_tls1_prf_new(void *provctx)
     if (!ossl_prov_is_running())
         return NULL;
 
-    if ((ctx = OPENSSL_zalloc(sizeof(*ctx))) == NULL)
+    if ((ctx = OPENSSL_zalloc(sizeof(*ctx))) == NULL) {
         ERR_raise(ERR_LIB_PROV, ERR_R_MALLOC_FAILURE);
+        return NULL;
+    }
     ctx->provctx = provctx;
     return ctx;
 }
index 487c3295f2dd9348528d8bff54ff69c9ee64621d..51b2ebf26b499d0c888baf0172fc4db25eadd7b6 100644 (file)
@@ -333,10 +333,12 @@ static void *x942kdf_new(void *provctx)
     KDF_X942 *ctx;
 
     if (!ossl_prov_is_running())
-        return 0;
+        return NULL;
 
-    if ((ctx = OPENSSL_zalloc(sizeof(*ctx))) == NULL)
+    if ((ctx = OPENSSL_zalloc(sizeof(*ctx))) == NULL) {
         ERR_raise(ERR_LIB_PROV, ERR_R_MALLOC_FAILURE);
+        return NULL;
+    }
     ctx->provctx = provctx;
     ctx->use_keybits = 1;
     return ctx;