Commit 881ff0c225 for openssl.org
commit 881ff0c225356a0f28bd55cea5a4c5204b7b7b8a
Author: Jiasheng Jiang <jiashengjiangcool@gmail.com>
Date: Wed Jun 25 23:06:59 2025 +0000
demos/cms/cms_denc.c: Add check for BIO_new_file()
Add check for the return value of BIO_new_file().
Fixes: 1728756 ("Detached encrypt/decrypt example, fix decrypt sample.")
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27897)
diff --git a/demos/cms/cms_denc.c b/demos/cms/cms_denc.c
index 53b680f674..41575b0223 100644
--- a/demos/cms/cms_denc.c
+++ b/demos/cms/cms_denc.c
@@ -57,7 +57,7 @@ int main(int argc, char **argv)
dout = BIO_new_file("smencr.out", "wb");
- if (!in)
+ if (in == NULL || dout == NULL)
goto err;
/* encrypt content */