[gmime] Fixed folding of headers containing really long words
- From: Jeffrey Stedfast <fejj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gmime] Fixed folding of headers containing really long words
- Date: Wed, 13 Jun 2012 23:34:18 +0000 (UTC)
commit 691fe773128c97fa1972b8ae685a3bf2094b4e60
Author: Jeffrey Stedfast <fejj gnome org>
Date: Wed Jun 13 19:33:21 2012 -0400
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)
ChangeLog | 9 +++++++++
gmime/gmime-utils.c | 8 ++++++--
2 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index f7b8cd9..70a0026 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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 ec79d62..40f888c 100644
--- a/gmime/gmime-utils.c
+++ b/gmime/gmime-utils.c
@@ -1181,7 +1181,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';
@@ -1189,6 +1189,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;
}
@@ -1746,7 +1747,7 @@ quoted_decode (const unsigned char *in, size_t len, unsigned char *out, int *sta
goto decode;
}
-
+
saved = 0;
need = 0;
@@ -2529,6 +2530,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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]