From: Dr. David von Oheimb Date: Mon, 14 Apr 2025 09:59:00 +0000 (+0200) Subject: asn_mime.c multi_split(): add missing I/O error checking X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1a8cc7fab0fe8d7f7d4d03a39a23fbb994924443;p=thirdparty%2Fopenssl.git asn_mime.c multi_split(): add missing I/O error checking Reviewed-by: Tomas Mraz Reviewed-by: Dmitry Belyavskiy (Merged from https://github.com/openssl/openssl/pull/27368) --- diff --git a/crypto/asn1/asn_mime.c b/crypto/asn1/asn_mime.c index 8c99b6ba3dc..fab66d791bd 100644 --- a/crypto/asn1/asn_mime.c +++ b/crypto/asn1/asn_mime.c @@ -692,14 +692,17 @@ static int multi_split(BIO *bio, int flags, const char *bound, STACK_OF(BIO) **r #else 1 #endif - || (flags & SMIME_CRLFEOL) != 0) - BIO_write(bpart, "\r\n", 2); - else - BIO_write(bpart, "\n", 1); + || (flags & SMIME_CRLFEOL) != 0) { + if (BIO_puts(bpart, "\r\n") < 0) + return 0; + } else { + if (BIO_puts(bpart, "\n") < 0) + return 0; + } } eol = next_eol; - if (len > 0) - BIO_write(bpart, linebuf, len); + if (len > 0 && BIO_write(bpart, linebuf, len) != len) + return 0; } } BIO_free(bpart);