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:53:34 +1000
commit148176ca323e3dfce5d5cdb5578c113c8d2440bb (patch)
treec961957e44d022111e623bef099d392ee8b65f30 /providers
parenteb27a90e41a62d3337c5e21e24ee72f1e49a445c (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)
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 6c1cf7e615..a8b23a705c 100644
--- a/providers/implementations/kdfs/sshkdf.c
+++ b/providers/implementations/kdfs/sshkdf.c
@@ -60,7 +60,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;
}