From fefe3169bb12865732a3395ce43995fc661ff10b Mon Sep 17 00:00:00 2001 From: jayaram Date: Wed, 30 Oct 2019 12:56:18 +0530 Subject: [PATCH] fix for Missing null check after OPENSSL_zalloc Fixes #10283 Reviewed-by: Matt Caswell Reviewed-by: Patrick Steuer (Merged from https://github.com/openssl/openssl/pull/10296) --- crypto/evp/keymgmt_lib.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crypto/evp/keymgmt_lib.c b/crypto/evp/keymgmt_lib.c index a14decd280..5e9ec73f7d 100644 --- a/crypto/evp/keymgmt_lib.c +++ b/crypto/evp/keymgmt_lib.c @@ -18,12 +18,14 @@ static OSSL_PARAM *paramdefs_to_params(const OSSL_PARAM *paramdefs) { size_t cnt; const OSSL_PARAM *p; - OSSL_PARAM *params, *q; + OSSL_PARAM *params = NULL, *q; for (cnt = 1, p = paramdefs; p->key != NULL; p++, cnt++) continue; params = OPENSSL_zalloc(cnt * sizeof(*params)); + if (params == NULL) + return NULL; for (p = paramdefs, q = params; ; p++, q++) { *q = *p; @@ -78,6 +80,8 @@ static void *allocate_params_space(OSSL_PARAM *params) return NULL; data = OPENSSL_zalloc(space); + if (data == NULL) + return NULL; for (space = 0, p = params; p->key != NULL; p++) { p->data = data + space; -- 2.25.1