]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Fix potential assert-crash when fetching body snippet
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 30 Nov 2020 20:10:28 +0000 (22:10 +0200)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Fri, 4 Dec 2020 11:13:31 +0000 (13:13 +0200)
This happened only in a rather special condition. Added unit test to
reproduce it.

Fixes:
Panic: file message-part-data.c: line 28 (message_part_data_is_plain_7bit): assertion failed: (data != NULL)

src/lib-storage/index/index-mail-headers.c

index d67b96e8318c4b304493b7ee52f89066c1c4389d..d63c24fbbee8d56a059930af00544df144676782 100644 (file)
@@ -417,7 +417,7 @@ static void index_mail_init_parser(struct index_mail *mail)
                        index_mail_set_message_parts_corrupted(&mail->mail.mail, error);
                        data->parts = NULL;
                }
-               if (data->parts == NULL) {
+               if (data->parts == NULL || data->parts != parts) {
                        /* The previous parsing didn't finish, so we're
                           re-parsing the header. The new parts don't have data
                           filled anymore. */