]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
demos/cms/cms_denc.c: Add check for BIO_new_file()
authorJiasheng Jiang <jiashengjiangcool@gmail.com>
Wed, 25 Jun 2025 23:06:59 +0000 (23:06 +0000)
committerTomas Mraz <tomas@openssl.org>
Tue, 1 Jul 2025 17:36:06 +0000 (19:36 +0200)
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)

(cherry picked from commit 881ff0c225356a0f28bd55cea5a4c5204b7b7b8a)

demos/cms/cms_denc.c

index 60b0aa192bc008ddf2ea5bfb3136283c6e12e834..45d18dc7a4d32a2d7f17cb2ddb62b6edb3ebf615 100644 (file)
@@ -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 */