]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-mail: Don't assert-crash when multipart doesn't actually have any parts.
authorTimo Sirainen <tss@iki.fi>
Mon, 15 Apr 2013 14:22:06 +0000 (17:22 +0300)
committerTimo Sirainen <tss@iki.fi>
Mon, 15 Apr 2013 14:22:06 +0000 (17:22 +0300)
src/lib-mail/message-parser.c

index ffbee0785bd3ce74387495e7c99ce4264aebcc3d..c011e518311ff688d6605544b2db3c5840113381 100644 (file)
@@ -839,7 +839,10 @@ static int preparsed_parse_body_init(struct message_parser_ctx *ctx,
        }
        i_stream_skip(ctx->input, offset - ctx->input->v_offset);
 
-       if ((ctx->part->flags & MESSAGE_PART_FLAG_MULTIPART) == 0)
+       /* multipart messages may begin with --boundary--, which makes them
+          not have any children. */
+       if ((ctx->part->flags & MESSAGE_PART_FLAG_MULTIPART) == 0 ||
+           ctx->part->children == NULL)
                ctx->parse_next_block = preparsed_parse_body_more;
        else
                ctx->parse_next_block = preparsed_parse_prologue_more;