]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
SMIME_text(): add missing I/O error checking
authorDr. David von Oheimb <dev@ddvo.net>
Mon, 14 Apr 2025 09:52:11 +0000 (11:52 +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 fc0a73c56646333d1e3f06d645142341369b5473..8c99b6ba3dc019a0366933957691b818ccad8a3a 100644 (file)
@@ -633,10 +633,9 @@ int SMIME_text(BIO *in, BIO *out)
     }
     sk_MIME_HEADER_pop_free(headers, mime_hdr_free);
     while ((len = BIO_read(in, iobuf, sizeof(iobuf))) > 0)
-        BIO_write(out, iobuf, len);
-    if (len < 0)
-        return 0;
-    return 1;
+        if (BIO_write(out, iobuf, len) != len && out != NULL)
+            return 0;
+    return len >= 0;
 }
 
 /*