]> git.ipfire.org Git - thirdparty/dovecot/core.git/commit
lib-storage: Fix bodystructure parsing crash if header is parsed twice
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Wed, 25 Jul 2018 10:17:45 +0000 (13:17 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Wed, 25 Jul 2018 10:28:23 +0000 (13:28 +0300)
commita14b731f3c87df76a0b5112a19e9b36162491049
treec556b57f3e03da3c132c24b1eeb5574a12f9f451
parent9753fd9410a2aaf7a0814eeeba2f67af7d782559
lib-storage: Fix bodystructure parsing crash if header is parsed twice

The second parsing will recreate the parser_ctx, discarding the old parsed
message_part.data for the header. On the second parsing
save_bodystructure_header=FALSE so the message_part.data isn't filled for
the header. Later on the bodystructure parsing assumes the data is set,
and crashes.

This only happened with mail_attachment_detection_options=add-flags-on-save
and Sieve script that first accessed a non-cached header and then used the
"body" extension.

Fixes segfault and also:
Panic: file imap-bodystructure.c: line 116 (part_write_body_multipart): assertion failed: (part->data != NULL)
src/lib-storage/index/index-mail-headers.c
src/lib-storage/index/index-mail.c
src/lib-storage/index/index-mail.h