changeset 7214:2d58b1c2dfd0 HEAD

The header ending a message/rfc822 doesn't belong to its child MIME part. Fixes a crash with fetching bodystructure.
author Timo Sirainen <tss@iki.fi>
date Mon, 04 Feb 2008 21:25:54 +0200
parents 45bfc162a43c
children 492c5dfc5fd8
files src/lib-mail/message-parser.c
diffstat 1 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-mail/message-parser.c	Mon Feb 04 19:12:46 2008 +0200
+++ b/src/lib-mail/message-parser.c	Mon Feb 04 21:25:54 2008 +0200
@@ -168,9 +168,11 @@
 	ctx->last_boundary = NULL;
 }
 
-static void parse_next_body_message_rfc822_init(struct message_parser_ctx *ctx)
+static int parse_next_body_message_rfc822_init(struct message_parser_ctx *ctx,
+					       struct message_block *block_r)
 {
 	ctx->part = message_part_append(ctx->part_pool, ctx->part);
+	return parse_next_header_init(ctx, block_r);
 }
 
 static int
@@ -532,10 +534,9 @@
 	if (ctx->last_boundary != NULL) {
 		parse_next_body_multipart_init(ctx);
 		ctx->parse_next_block = parse_next_body_to_boundary;
-	} else if (part->flags & MESSAGE_PART_FLAG_MESSAGE_RFC822) {
-		parse_next_body_message_rfc822_init(ctx);
-		ctx->parse_next_block = parse_next_header_init;
-	} else if (ctx->boundaries != NULL)
+	} else if (part->flags & MESSAGE_PART_FLAG_MESSAGE_RFC822)
+		ctx->parse_next_block = parse_next_body_message_rfc822_init;
+	else if (ctx->boundaries != NULL)
 		ctx->parse_next_block = parse_next_body_to_boundary;
 	else
 		ctx->parse_next_block = parse_next_body_to_eof;