From: Jiasheng Jiang Date: Wed, 25 Jun 2025 23:06:59 +0000 (+0000) Subject: demos/cms/cms_denc.c: Add check for BIO_new_file() X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cce4d5eb5b7f29d4e79392c1cae0eaef643628a0;p=thirdparty%2Fopenssl.git 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 Reviewed-by: Paul Dale Reviewed-by: Matt Caswell Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/27897) (cherry picked from commit 881ff0c225356a0f28bd55cea5a4c5204b7b7b8a) --- diff --git a/demos/cms/cms_denc.c b/demos/cms/cms_denc.c index 53b680f6748..41575b0223a 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 */