dovecot-2.2: istream-qp-decoder: Fixed assert-crashes caused by ...

dovecot at dovecot.org dovecot at dovecot.org
Sun Apr 7 23:56:11 EEST 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/bb25fa35d887
changeset: 16238:bb25fa35d887
user:      Timo Sirainen <tss at iki.fi>
date:      Sun Apr 07 23:56:01 2013 +0300
description:
istream-qp-decoder: Fixed assert-crashes caused by recent forced-CRLF q-p change.

diffstat:

 src/lib-mail/istream-qp-decoder.c |  9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diffs (24 lines):

diff -r 73bef641620d -r bb25fa35d887 src/lib-mail/istream-qp-decoder.c
--- a/src/lib-mail/istream-qp-decoder.c	Sun Apr 07 23:26:52 2013 +0300
+++ b/src/lib-mail/istream-qp-decoder.c	Sun Apr 07 23:56:01 2013 +0300
@@ -45,15 +45,16 @@
 	if (size == 0)
 		return 0;
 
-	/* the decoded quoted-printable content can never be larger than the
-	   encoded content. at worst they are equal. */
+	/* normally the decoded quoted-printable content can't be larger than
+	   the encoded content, but because we always use CRLFs, it may use
+	   twice as much space by only converting LFs to CRLFs. */
 	i_stream_try_alloc(stream, size, &avail);
 	buffer_avail = stream->buffer_size - stream->pos;
 
-	if (size > buffer_avail) {
+	if (size > buffer_avail/2) {
 		/* can't fit everything to destination buffer.
 		   write as much as we can. */
-		size = buffer_avail;
+		size = buffer_avail/2;
 		if (size == 0)
 			return -2;
 	}


More information about the dovecot-cvs mailing list