From: Timo Sirainen Date: Sun, 9 May 2004 17:05:18 +0000 (+0300) Subject: If value of header contains only LWSP, return all LWSP instead of returning X-Git-Tag: 1.1.alpha1~4126 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f2d40f82a9fa08c238a2fd37b5a594ca80506b13;p=thirdparty%2Fdovecot%2Fcore.git If value of header contains only LWSP, return all LWSP instead of returning just empty value. --HG-- branch : HEAD --- diff --git a/src/lib-mail/message-parser.c b/src/lib-mail/message-parser.c index 67acf0f51f..9ea0d1273b 100644 --- a/src/lib-mail/message-parser.c +++ b/src/lib-mail/message-parser.c @@ -842,15 +842,27 @@ message_parse_header_next(struct message_header_parser_ctx *ctx) line->name_len = str_len(ctx->name); } else { /* get value. skip all LWSP after ':'. Note that RFC2822 - doesn't say we should, but history behind it.. */ + doesn't say we should, but history behind it.. + + Exception to this is if the value consists only of LWSP, + then skip only the one LWSP after ':'. */ line->value = msg + colon_pos+1; line->value_len = size - colon_pos - 1; - while (line->value_len > 0 && - IS_LWSP(line->value[0])) { + while (line->value_len > 0 && IS_LWSP(line->value[0])) { line->value++; line->value_len--; } + if (line->value_len == 0) { + /* everything was LWSP */ + line->value = msg + colon_pos+1; + line->value_len = size - colon_pos - 1; + if (line->value_len > 0 && IS_LWSP(line->value[0])) { + line->value++; + line->value_len--; + } + } + /* get name, skip LWSP before ':' */ while (colon_pos > 0 && IS_LWSP(msg[colon_pos-1])) colon_pos--;