changeset 7217:4674cdad3672 HEAD

Assert-crashfix when header line was longer than our input buffer and MESSAGE_HEADER_PARSER_FLAG_CLEAN_ONELINE was used.
author Timo Sirainen <tss@iki.fi>
date Fri, 08 Feb 2008 08:46:08 +0200
parents 56f8ac7a3a77
children 43d2f70fb279
files src/lib-mail/message-header-parser.c
diffstat 1 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-mail/message-header-parser.c	Wed Feb 06 19:02:25 2008 +0200
+++ b/src/lib-mail/message-header-parser.c	Fri Feb 08 08:46:08 2008 +0200
@@ -339,16 +339,19 @@
 		line->full_value = line->value;
 		line->full_value_len = line->value_len;
 	} else if (line->use_full_value) {
-		/* continue saving the full value */
-		if (!last_no_newline) {
+		/* continue saving the full value. */
+		if (last_no_newline) {
+			/* line is longer than fit into our buffer, so we
+			   were forced to break it into multiple
+			   message_header_lines */
+		} else {
 			if (last_crlf)
 				buffer_append_c(ctx->value_buf, '\r');
 			buffer_append_c(ctx->value_buf, '\n');
 		}
 		if ((ctx->flags & MESSAGE_HEADER_PARSER_FLAG_CLEAN_ONELINE) &&
-		    line->value_len > 0 && line->value[0] != ' ') {
-			i_assert(IS_LWSP(line->value[0]));
-
+		    line->value_len > 0 && line->value[0] != ' ' &&
+		    IS_LWSP(line->value[0])) {
 			buffer_append_c(ctx->value_buf, ' ');
 			buffer_append(ctx->value_buf,
 				      line->value + 1, line->value_len - 1);