changeset 13540:00b6848a5a63

lib-mail: Added broken input workaround to rfc822_parse_content_param().
author Timo Sirainen <tss@iki.fi>
date Thu, 22 Sep 2011 13:09:18 +0300
parents 1ff636720b9f
children 645a56f9d8ee
files src/lib-mail/rfc822-parser.c
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-mail/rfc822-parser.c	Thu Sep 22 12:54:27 2011 +0300
+++ b/src/lib-mail/rfc822-parser.c	Thu Sep 22 13:09:18 2011 +0300
@@ -408,6 +408,15 @@
 	} else if (*ctx->data == '"') {
 		ret = rfc822_parse_quoted_string(ctx, tmp);
 		str_unescape(str_c_modifiable(tmp) + value_pos);
+	} else if (ctx->data != ctx->end && *ctx->data == '=') {
+		/* workaround for broken input:
+		   name==?utf-8?b?...?= */
+		while (ctx->data != ctx->end && *ctx->data != ';' &&
+		       *ctx->data != ' ' && *ctx->data != '\t' &&
+		       *ctx->data != '\r' && *ctx->data != '\n') {
+			str_append_c(tmp, *ctx->data);
+			ctx->data++;
+		}
 	} else {
 		ret = rfc822_parse_mime_token(ctx, tmp);
 	}