From 013e94ff3653aa6025e7f0992a3519308d952a01 Mon Sep 17 00:00:00 2001 From: Colin Leroy Date: Mon, 3 Jan 2011 19:11:00 +0000 Subject: [PATCH] 2011-01-03 [colin] 3.7.8cvs25 * src/unmime.c Fix bug #2299, "Incorrect handling of quoted printable coma in headers". As this is really painful to fix by switching the whole stuff to a list of headers tokens, we workaround the problem by adding quotes around the encoded-word (making it a quoted-string which continuity is already handled). --- ChangeLog | 9 +++++++++ PATCHSETS | 1 + configure.ac | 2 +- src/unmime.c | 11 +++++++++++ 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 4ea952e78..6a6ff9b3f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2011-01-03 [colin] 3.7.8cvs25 + + * src/unmime.c + Fix bug #2299, "Incorrect handling of quoted printable coma + in headers". As this is really painful to fix by switching + the whole stuff to a list of headers tokens, we workaround + the problem by adding quotes around the encoded-word (making + it a quoted-string which continuity is already handled). + 2011-01-03 [colin] 3.7.8cvs24 * src/procheader.c diff --git a/PATCHSETS b/PATCHSETS index bfa969536..3d315571f 100644 --- a/PATCHSETS +++ b/PATCHSETS @@ -4098,3 +4098,4 @@ ( cvs diff -u -r 1.50.2.60 -r 1.50.2.61 src/compose.h; ) > 3.7.8cvs22.patchset ( cvs diff -u -r 1.382.2.564 -r 1.382.2.565 src/compose.c; ) > 3.7.8cvs23.patchset ( cvs diff -u -r 1.47.2.51 -r 1.47.2.52 src/procheader.c; ) > 3.7.8cvs24.patchset +( cvs diff -u -r 1.8.2.14 -r 1.8.2.15 src/unmime.c; ) > 3.7.8cvs25.patchset diff --git a/configure.ac b/configure.ac index ec163f640..b227b76e7 100644 --- a/configure.ac +++ b/configure.ac @@ -12,7 +12,7 @@ MINOR_VERSION=7 MICRO_VERSION=8 INTERFACE_AGE=0 BINARY_AGE=0 -EXTRA_VERSION=24 +EXTRA_VERSION=25 EXTRA_RELEASE= EXTRA_GTK2_VERSION= diff --git a/src/unmime.c b/src/unmime.c index 0fe584059..6abd31ebd 100644 --- a/src/unmime.c +++ b/src/unmime.c @@ -114,6 +114,17 @@ gchar *unmime_header(const gchar *encoded_str) continue; } + /* An encoded word MUST not appear within a quoted string, + * so quoting that word after decoding should be safe. + * We check there are no quotes just to be sure. If there + * are, well, the comma won't pose a problem, probably. + */ + if (strchr(decoded_text, ',') && !strchr(decoded_text, '"')) { + gchar *tmp = g_strdup_printf("\"%s\"", decoded_text); + g_free(decoded_text); + decoded_text = tmp; + } + /* convert to UTF-8 */ conv_str = conv_codeset_strdup(decoded_text, charset, NULL); if (!conv_str || !g_utf8_validate(conv_str, -1, NULL)) {