dovecot-2.2-pigeonhole: lib-sieve: message body: Fixed assert fa...

pigeonhole at rename-it.nl pigeonhole at rename-it.nl
Tue Dec 29 19:21:08 UTC 2015


details:   http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/ee866d88aeb3
changeset: 2182:ee866d88aeb3
user:      Stephan Bosch <stephan at rename-it.nl>
date:      Tue Dec 29 20:20:29 2015 +0100
description:
lib-sieve: message body: Fixed assert failure in handling of body parts that are converted to text.
No final '\0' character was added to those body parts.
This occurs for the body test with the (default) `:text' body transform.

diffstat:

 src/lib-sieve/sieve-message.c |  11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diffs (37 lines):

diff -r 450c272a57c0 -r ee866d88aeb3 src/lib-sieve/sieve-message.c
--- a/src/lib-sieve/sieve-message.c	Mon Dec 28 20:46:14 2015 +0100
+++ b/src/lib-sieve/sieve-message.c	Tue Dec 29 20:20:29 2015 +0100
@@ -969,10 +969,8 @@
 	char *part_data;
 	size_t part_size;
 
-	/* Add terminating NUL to the body part buffer */
-	buffer_append_c(buf, '\0');
+	/* Extract text if requested */
 	result_buf = buf;
-
 	if ( extract_text ) {
 		if ( mail_html2text_content_type_match
 			(body_part->content_type) ) {
@@ -984,15 +982,20 @@
 			html2text = mail_html2text_init(0);
 			mail_html2text_more(html2text, buf->data, buf->used, text_buf);
 			mail_html2text_deinit(&html2text);
-	
+
 			result_buf = text_buf;
 		}
 	}
 
+	/* Add terminating NUL to the body part buffer */
+	buffer_append_c(result_buf, '\0');
+
+	/* Make copy of the buffer */
 	part_data = p_malloc(pool, result_buf->used);
 	memcpy(part_data, result_buf->data, result_buf->used);
 	part_size = result_buf->used - 1;
 
+	/* Free text buffer if used */
 	if ( text_buf != NULL)
 		buffer_free(&text_buf);
 


More information about the dovecot-cvs mailing list