From adfb1f3d0cb4f8444f08010d60a2706c3e8c6696 Mon Sep 17 00:00:00 2001 From: inoguchi Date: Wed, 19 Jan 2022 13:47:44 +0000 Subject: [PATCH] Check return value from EVP_CIPHER_CTX_new in cms_pwri.c CID 345137 ok jsing@ tb@ --- lib/libcrypto/cms/cms_pwri.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/libcrypto/cms/cms_pwri.c b/lib/libcrypto/cms/cms_pwri.c index cf28dfc8ddb..eb241a60fe9 100644 --- a/lib/libcrypto/cms/cms_pwri.c +++ b/lib/libcrypto/cms/cms_pwri.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cms_pwri.c,v 1.26 2019/08/12 18:04:57 jsing Exp $ */ +/* $OpenBSD: cms_pwri.c,v 1.27 2022/01/19 13:47:44 inoguchi Exp $ */ /* * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project. @@ -126,7 +126,9 @@ CMS_add0_recipient_password(CMS_ContentInfo *cms, int iter, int wrap_nid, if (encalg == NULL) { goto merr; } - ctx = EVP_CIPHER_CTX_new(); + + if ((ctx = EVP_CIPHER_CTX_new()) == NULL) + goto merr; if (EVP_EncryptInit_ex(ctx, kekciph, NULL, NULL, NULL) <= 0) { CMSerror(ERR_R_EVP_LIB); -- 2.20.1