dovecot-1.2: message_header_decode*() should ignore LWSP between...
dovecot at dovecot.org
dovecot at dovecot.org
Mon Sep 14 02:01:33 EEST 2009
details: http://hg.dovecot.org/dovecot-1.2/rev/28241a6e1178
changeset: 9381:28241a6e1178
user: Timo Sirainen <tss at iki.fi>
date: Sun Sep 13 19:01:28 2009 -0400
description:
message_header_decode*() should ignore LWSP between two encoded-words.
diffstat:
1 file changed, 14 insertions(+), 1 deletion(-)
src/lib-mail/message-header-decode.c | 15 ++++++++++++++-
diffs (32 lines):
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 @@ message_header_decode_encoded(const unsi
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 @@ void message_header_decode(const unsigne
}
/* 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)) {
More information about the dovecot-cvs
mailing list