summaryrefslogtreecommitdiff
path: root/pith/smime.c
diff options
context:
space:
mode:
Diffstat (limited to 'pith/smime.c')
-rw-r--r--pith/smime.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/pith/smime.c b/pith/smime.c
index ccaf1066..a2a6a112 100644
--- a/pith/smime.c
+++ b/pith/smime.c
@@ -2488,10 +2488,14 @@ body_to_bio(BODY *body)
if((len=BIO_ctrl_pending(bio)) > 1){
BUF_MEM *biobuf = NULL;
+ /* this code used to truncate without closing the bio, and
+ then resetting the memory, causing non validation in
+ signatures. Fix contributed by Bernd Edlinger.
+ */
BIO_get_mem_ptr(bio, &biobuf);
- if(biobuf){
- BUF_MEM_grow(biobuf, len-2); /* remove CRLF */
- }
+ BIO_set_close(bio, 0);
+ BUF_MEM_grow(biobuf, len-2); /* remove CRLF */
+ BIO_set_mem_buf(bio, biobuf, 1);
}
return bio;