Fix from HEAD.
authorDr. Stephen Henson <steve@openssl.org>
Tue, 5 Aug 2008 15:56:11 +0000 (15:56 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Tue, 5 Aug 2008 15:56:11 +0000 (15:56 +0000)
crypto/asn1/asn_mime.c
crypto/cms/cms_smime.c

index fe7c4ec7abe4952ee2c6c62b5f0128528decf0b3..bc80b20d6323a1d209d868cd5a419b1e32c8a689 100644 (file)
@@ -526,6 +526,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;
 }
 
index f79c504e913705c650967fa652818b4649225f2f..b35d28d411a3f77d6fb22626262b03cb33c7e769 100644 (file)
@@ -89,11 +89,13 @@ static int cms_copy_content(BIO *out, BIO *in, unsigned int flags)
                                if (!BIO_get_cipher_status(in))
                                        goto err;
                                }
+                       if (i < 0)
+                               goto err;
                        break;
                        }
                                
-               if (tmpout)
-                       BIO_write(tmpout, buf, i);
+               if (tmpout && (BIO_write(tmpout, buf, i) != i))
+                       goto err;
        }
 
        if(flags & CMS_TEXT)