2011-01-03 [colin] 3.7.8cvs26

* src/unmime.c
		Better quote-checking when unmim-ing headers
		that may have comas.
This commit is contained in:
Colin Leroy 2011-01-03 20:22:13 +00:00
parent 013e94ff36
commit 532f02fadc
4 changed files with 23 additions and 2 deletions

View file

@ -1,3 +1,9 @@
2011-01-03 [colin] 3.7.8cvs26
* src/unmime.c
Better quote-checking when unmim-ing headers
that may have comas.
2011-01-03 [colin] 3.7.8cvs25
* src/unmime.c

View file

@ -4099,3 +4099,4 @@
( 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
( cvs diff -u -r 1.8.2.15 -r 1.8.2.16 src/unmime.c; ) > 3.7.8cvs26.patchset

View file

@ -12,7 +12,7 @@ MINOR_VERSION=7
MICRO_VERSION=8
INTERFACE_AGE=0
BINARY_AGE=0
EXTRA_VERSION=25
EXTRA_VERSION=26
EXTRA_RELEASE=
EXTRA_GTK2_VERSION=

View file

@ -45,11 +45,13 @@ gchar *unmime_header(const gchar *encoded_str)
GString *outbuf;
gchar *out_str;
gsize out_len;
int in_quote = FALSE;
outbuf = g_string_sized_new(strlen(encoded_str) * 2);
while (*p != '\0') {
gchar *decoded_text = NULL;
const gchar *quote_p;
gint len;
eword_begin_p = strstr(p, ENCODED_WORD_BEGIN);
@ -57,6 +59,18 @@ gchar *unmime_header(const gchar *encoded_str)
g_string_append(outbuf, p);
break;
}
quote_p = p;
while ((quote_p = strchr(quote_p, '"')) != NULL) {
if (quote_p && quote_p < eword_begin_p) {
/* Found a quote before the encoded word. */
in_quote = !in_quote;
quote_p++;
}
if (quote_p >= eword_begin_p)
break;
}
encoding_begin_p = strchr(eword_begin_p + 2, '?');
if (!encoding_begin_p) {
g_string_append(outbuf, p);
@ -119,7 +133,7 @@ gchar *unmime_header(const gchar *encoded_str)
* 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, '"')) {
if (strchr(decoded_text, ',') && !in_quote) {
gchar *tmp = g_strdup_printf("\"%s\"", decoded_text);
g_free(decoded_text);
decoded_text = tmp;