summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/cms/cms_smime.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/cms/cms_smime.c')
-rw-r--r--src/lib/libcrypto/cms/cms_smime.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/lib/libcrypto/cms/cms_smime.c b/src/lib/libcrypto/cms/cms_smime.c
index f79c504e91..b9463f9abb 100644
--- a/src/lib/libcrypto/cms/cms_smime.c
+++ b/src/lib/libcrypto/cms/cms_smime.c
@@ -68,7 +68,10 @@ static int cms_copy_content(BIO *out, BIO *in, unsigned int flags)
68 if (out == NULL) 68 if (out == NULL)
69 tmpout = BIO_new(BIO_s_null()); 69 tmpout = BIO_new(BIO_s_null());
70 else if (flags & CMS_TEXT) 70 else if (flags & CMS_TEXT)
71 {
71 tmpout = BIO_new(BIO_s_mem()); 72 tmpout = BIO_new(BIO_s_mem());
73 BIO_set_mem_eof_return(tmpout, 0);
74 }
72 else 75 else
73 tmpout = out; 76 tmpout = out;
74 77
@@ -89,11 +92,13 @@ static int cms_copy_content(BIO *out, BIO *in, unsigned int flags)
89 if (!BIO_get_cipher_status(in)) 92 if (!BIO_get_cipher_status(in))
90 goto err; 93 goto err;
91 } 94 }
95 if (i < 0)
96 goto err;
92 break; 97 break;
93 } 98 }
94 99
95 if (tmpout) 100 if (tmpout && (BIO_write(tmpout, buf, i) != i))
96 BIO_write(tmpout, buf, i); 101 goto err;
97 } 102 }
98 103
99 if(flags & CMS_TEXT) 104 if(flags & CMS_TEXT)