]> 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:35:28 +0000 (19:35 +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)

demos/cms/cms_denc.c

index 53b680f67484d32f47c2305961128a00779225f6..41575b0223a0767f5bdd6a6c10fe8fe5eec19039 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 */