2011-01-03 [colin] 3.7.8cvs25
authorColin Leroy <colin@colino.net>
Mon, 3 Jan 2011 19:11:00 +0000 (19:11 +0000)
committerColin Leroy <colin@colino.net>
Mon, 3 Jan 2011 19:11:00 +0000 (19:11 +0000)
* 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
PATCHSETS
configure.ac
src/unmime.c

index 4ea952e..6a6ff9b 100644 (file)
--- 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
index bfa9695..3d31557 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( 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
index ec163f6..b227b76 100644 (file)
@@ -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=
 
index 0fe5840..6abd31e 100644 (file)
@@ -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)) {