]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
asn_mime.c multi_split(): add missing I/O error checking
authorDr. David von Oheimb <dev@ddvo.net>
Mon, 14 Apr 2025 09:59:00 +0000 (11:59 +0200)
committerDr. David von Oheimb <dev@ddvo.net>
Wed, 14 May 2025 06:43:21 +0000 (08:43 +0200)
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/27368)

crypto/asn1/asn_mime.c

index 8c99b6ba3dc019a0366933957691b818ccad8a3a..fab66d791bddca87f1310054ae5157b67b7e58ac 100644 (file)
@@ -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);