summaryrefslogtreecommitdiffstats
path: root/providers
diff options
context:
space:
mode:
authorPauli <pauli@openssl.org>2022-04-01 08:06:17 +1100
committerPauli <pauli@openssl.org>2022-04-11 09:54:32 +1000
commit7d486b2c0ea43227b5d9b6d3b66a5f4365ecdbae (patch)
treed46f79bb3cee7ae71b00fe15fd8a89a973a67713 /providers
parenta63529f893fac5f9655b6576c1a4b8e215cd3284 (diff)
kdf: avoid NULL dereference on malloc failure in sshkdf
Fixes #18009 Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/18011) (cherry picked from commit 148176ca323e3dfce5d5cdb5578c113c8d2440bb)
Diffstat (limited to 'providers')
-rw-r--r--providers/implementations/kdfs/sshkdf.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/providers/implementations/kdfs/sshkdf.c b/providers/implementations/kdfs/sshkdf.c
index be23c2143d..09df471dd3 100644
--- a/providers/implementations/kdfs/sshkdf.c
+++ b/providers/implementations/kdfs/sshkdf.c
@@ -59,7 +59,8 @@ static void *kdf_sshkdf_new(void *provctx)
if ((ctx = OPENSSL_zalloc(sizeof(*ctx))) == NULL)
ERR_raise(ERR_LIB_PROV, ERR_R_MALLOC_FAILURE);
- ctx->provctx = provctx;
+ else
+ ctx->provctx = provctx;
return ctx;
}