Mercurial > dovecot > original-hg > dovecot-1.2
changeset 9381:28241a6e1178 HEAD
message_header_decode*() should ignore LWSP between two encoded-words.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sun, 13 Sep 2009 19:01:28 -0400 |
parents | fe063e0d7109 |
children | 6df681067e0a |
files | src/lib-mail/message-header-decode.c |
diffstat | 1 files changed, 14 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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)) {