diff options
author | Jeffrey Stedfast <fejj@gnome.org> | 2012-06-13 19:33:21 -0400 |
---|---|---|
committer | Jeffrey Stedfast <fejj@gnome.org> | 2012-10-22 02:24:59 -0400 |
commit | aa665f4977c67f1f73d08160abc92d998b15be38 (patch) | |
tree | 3e04ddfca880b581de536e4505560d5719ad54b9 | |
parent | 7ccaaa804a5d3301f158763ccc1159fb40741d5b (diff) | |
download | gmime-aa665f4977c67f1f73d08160abc92d998b15be38.tar.gz |
Fixed folding of headers containing really long words
2012-06-13 Jeffrey Stedfast <fejj@gnome.org>
* gmime/gmime-utils.c (rfc2047_encode_get_rfc822_words): When
breaking up really long atom tokens, change the word type to
RFC2047 so that we encode them, thus preventing forced header
folding which cannot be unmunged.
(header_fold): Fixed for cases where the first word in a header
is 68 chars. (Note: this fix is largely unnecessary due to the
above fix)
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | gmime/gmime-utils.c | 8 |
2 files changed, 15 insertions, 2 deletions
@@ -1,5 +1,14 @@ 2012-06-13 Jeffrey Stedfast <fejj@gnome.org> + * gmime/gmime-utils.c (rfc2047_encode_get_rfc822_words): When + breaking up really long atom tokens, change the word type to + RFC2047 so that we encode them, thus preventing forced header + folding which cannot be unmunged. + (header_fold): Fixed for cases where the first word in a header is + 68 chars. (Note: this fix is largely unnecessary due to the above fix) + +2012-06-13 Jeffrey Stedfast <fejj@gnome.org> + * gmime/gmime-message.c: When setting a header, make sure to always clear the header list cache of the toplevel mime_part as well. diff --git a/gmime/gmime-utils.c b/gmime/gmime-utils.c index 83d7e0fc..9f1195e6 100644 --- a/gmime/gmime-utils.c +++ b/gmime/gmime-utils.c @@ -1182,7 +1182,7 @@ header_fold (const char *in, gboolean structured) len = strcspn (inptr, " \t\n"); if (len > 1 && outlen + len > GMIME_FOLD_LEN) { - if (outlen > 1 && out->len > fieldlen + 2) { + if (outlen > 1 && out->len >= fieldlen + 2) { if (last_was_lwsp) { if (structured) out->str[out->len - 1] = '\t'; @@ -1190,6 +1190,7 @@ header_fold (const char *in, gboolean structured) g_string_insert_c (out, out->len - 1, '\n'); } else g_string_append (out, "\n\t"); + outlen = 1; } @@ -1747,7 +1748,7 @@ quoted_decode (const unsigned char *in, size_t len, unsigned char *out, int *sta goto decode; } - + saved = 0; need = 0; @@ -2530,6 +2531,9 @@ rfc2047_encode_get_rfc822_words (const char *in, gboolean phrase) } if (count >= GMIME_FOLD_PREENCODED) { + if (type == WORD_ATOM) + type = WORD_2047; + word = rfc822_word_new (); word->next = NULL; word->start = start; |