From 148176ca323e3dfce5d5cdb5578c113c8d2440bb Mon Sep 17 00:00:00 2001 From: Pauli Date: Fri, 1 Apr 2022 08:06:17 +1100 Subject: [PATCH] kdf: avoid NULL dereference on malloc failure in sshkdf Fixes #18009 Reviewed-by: Tomas Mraz Reviewed-by: Shane Lontis (Merged from https://github.com/openssl/openssl/pull/18011) --- providers/implementations/kdfs/sshkdf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/providers/implementations/kdfs/sshkdf.c b/providers/implementations/kdfs/sshkdf.c index 6c1cf7e615d..a8b23a705cf 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; } -- 2.47.3