dovecot: If header contains invalid MIME input, preserve the =? ...

dovecot at dovecot.org dovecot at dovecot.org
Sat Dec 8 15:42:28 EET 2007


details:   http://hg.dovecot.org/dovecot/rev/63e225ab7361
changeset: 6950:63e225ab7361
user:      Timo Sirainen <tss at iki.fi>
date:      Sat Dec 08 15:42:25 2007 +0200
description:
If header contains invalid MIME input, preserve the =? in output.

diffstat:

1 file changed, 8 insertions(+), 3 deletions(-)
src/lib-mail/message-header-decode.c |   11 ++++++++---

diffs (28 lines):

diff -r eda51f08e8bf -r 63e225ab7361 src/lib-mail/message-header-decode.c
--- a/src/lib-mail/message-header-decode.c	Sat Dec 08 15:04:52 2007 +0200
+++ b/src/lib-mail/message-header-decode.c	Sat Dec 08 15:42:25 2007 +0200
@@ -62,7 +62,7 @@ void message_header_decode(const unsigne
 {
 	buffer_t *decodebuf = NULL;
 	unsigned int charsetlen = 0;
-	size_t pos, start_pos;
+	size_t pos, start_pos, ret;
 
 	/* =?charset?Q|B?text?= */
 	start_pos = pos = 0;
@@ -90,8 +90,13 @@ void message_header_decode(const unsigne
 		}
 
 		pos += 2;
-		pos += message_header_decode_encoded(data + pos, size - pos,
-						     decodebuf, &charsetlen);
+		ret = message_header_decode_encoded(data + pos, size - pos,
+						    decodebuf, &charsetlen);
+		if (ret == 0) {
+			start_pos = pos-2;
+			continue;
+		}
+		pos += ret;
 
 		if (decodebuf->used > charsetlen) {
 			/* decodebuf contains <charset> NUL <text> */


More information about the dovecot-cvs mailing list