]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: When getting decoded headers, don't fail when MIME encoded-words expand...
authorTimo Sirainen <tss@iki.fi>
Wed, 23 Jun 2010 13:59:49 +0000 (14:59 +0100)
committerTimo Sirainen <tss@iki.fi>
Wed, 23 Jun 2010 13:59:49 +0000 (14:59 +0100)
This fixes errors like: Corrupted index cache file dovecot.index.cache:
Broken header Subject for mail UID 1

--HG--
branch : HEAD

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

index f6147c945957ef8c91e988d0e1387fc75de17d35..21d0f333528c171a4202825a5f298603845abbb9 100644 (file)
@@ -722,13 +722,14 @@ index_mail_headers_decode(struct index_mail *mail, const char *const **_list,
        for (i = 0; i < count; i++) {
                str_truncate(str, 0);
                input = list[i];
-               if (message_header_decode_utf8((const unsigned char *)input,
-                                              strlen(list[i]), str, FALSE))
-                       input = str_c(str);
+               /* unfold all lines into a single line */
                if (unfold_header(mail->data_pool, &input) < 0)
                        return -1;
-               if (input == str->data)
-                       input = p_strdup(mail->data_pool, input);
+
+               /* 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 = p_strdup(mail->data_pool, str_c(str));
                decoded_list[i] = input;
        }
        *_list = decoded_list;