# HG changeset patch # User Timo Sirainen # Date 1252882888 14400 # Node ID 28241a6e1178302ee8eb483cbcc46f504bf10328 # Parent fe063e0d71096529bfcd94ac19fb42a51db53899 message_header_decode*() should ignore LWSP between two encoded-words. diff -r fe063e0d7109 -r 28241a6e1178 src/lib-mail/message-header-decode.c --- a/src/lib-mail/message-header-decode.c Sun Sep 13 18:36:09 2009 -0400 +++ b/src/lib-mail/message-header-decode.c Sun Sep 13 19:01:28 2009 -0400 @@ -56,6 +56,18 @@ return start_pos[2] + 2; } +static bool is_only_lwsp(const unsigned char *data, unsigned int size) +{ + unsigned int i; + + for (i = 0; i < size; i++) { + if (!(data[i] == ' ' || data[i] == '\t' || + data[i] == '\r' || data[i] == '\n')) + return FALSE; + } + return TRUE; +} + void message_header_decode(const unsigned char *data, size_t size, message_header_decode_callback_t *callback, void *context) @@ -73,7 +85,8 @@ } /* encoded string beginning */ - if (pos != start_pos) { + if (pos != start_pos && + !is_only_lwsp(data+start_pos, pos-start_pos)) { /* send the unencoded data so far */ if (!callback(data + start_pos, pos - start_pos, NULL, context)) {