From: Dr. David von Oheimb Date: Mon, 14 Apr 2025 09:10:52 +0000 (+0200) Subject: apps/cms.c: add failure handling for I/O errors of 'BIO_printf(out, ...)' X-Git-Tag: openssl-3.6.0-alpha1~752 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=88777599a6fa65cc812f60169784512798ca6395;p=thirdparty%2Fopenssl.git apps/cms.c: add failure handling for I/O errors of 'BIO_printf(out, ...)' Reviewed-by: Tomas Mraz Reviewed-by: Dmitry Belyavskiy (Merged from https://github.com/openssl/openssl/pull/27368) --- diff --git a/apps/cms.c b/apps/cms.c index 7af43a2afc4..8c7feed4312 100644 --- a/apps/cms.c +++ b/apps/cms.c @@ -1261,12 +1261,12 @@ int cms_main(int argc, char **argv) } ret = 1; } else if (outformat == FORMAT_SMIME) { - if (to) - BIO_printf(out, "To: %s%s", to, mime_eol); - if (from) - BIO_printf(out, "From: %s%s", from, mime_eol); - if (subject) - BIO_printf(out, "Subject: %s%s", subject, mime_eol); + if (to != NULL && BIO_printf(out, "To: %s%s", to, mime_eol) < 0) + goto end; + if (from != NULL && BIO_printf(out, "From: %s%s", from, mime_eol) < 0) + goto end; + if (subject != NULL && BIO_printf(out, "Subject: %s%s", subject, mime_eol) < 0) + goto end; if (operation == SMIME_RESIGN) ret = SMIME_write_CMS(out, cms, indata, flags); else