Correctly handle errors in CMS I/O code.
[openssl.git] / crypto / asn1 / asn_mime.c
index 8fbdf21..c1d1b12 100644 (file)
@@ -592,6 +592,8 @@ 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;
 }