Mercurial > dovecot > original-hg > dovecot-1.2
changeset 9587:659f72bf92ae HEAD
lib-storage: When getting decoded headers, don't fail when MIME encoded-words expand to LFs.
This fixes errors like: Corrupted index cache file dovecot.index.cache:
Broken header Subject for mail UID 1
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Wed, 23 Jun 2010 14:59:49 +0100 |
parents | 97b702abd132 |
children | 4af00b22a466 |
files | src/lib-storage/index/index-mail-headers.c |
diffstat | 1 files changed, 6 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-storage/index/index-mail-headers.c Mon Jun 21 21:17:58 2010 +0100 +++ b/src/lib-storage/index/index-mail-headers.c Wed Jun 23 14:59:49 2010 +0100 @@ -722,13 +722,14 @@ for (i = 0; i < count; i++) { str_truncate(str, 0); input = list[i]; + /* unfold all lines into a single line */ + if (unfold_header(mail->data_pool, &input) < 0) + return -1; + + /* decode MIME encoded-words. decoding may also add new LFs. */ if (message_header_decode_utf8((const unsigned char *)input, strlen(list[i]), str, FALSE)) - input = str_c(str); - if (unfold_header(mail->data_pool, &input) < 0) - return -1; - if (input == str->data) - input = p_strdup(mail->data_pool, input); + input = p_strdup(mail->data_pool, str_c(str)); decoded_list[i] = input; } *_list = decoded_list;