message header parser: Fixed handling NUL characters in header names.
line->name_len was too large and line->middle pointer may have pointed past
allocated memory. These may have caused crashes/corruption (fts, mbox at
least).
1.1 --- a/src/lib-mail/message-header-parser.c Fri Mar 04 19:28:31 2011 +0200
1.2 +++ b/src/lib-mail/message-header-parser.c Wed May 11 15:17:02 2011 +0300
1.3 @@ -310,7 +310,9 @@
1.4 colon_pos--;
1.5
1.6 str_truncate(ctx->name, 0);
1.7 - str_append_n(ctx->name, msg, colon_pos);
1.8 + /* use buffer_append() so the name won't be truncated if there
1.9 + are NULs. */
1.10 + buffer_append(ctx->name, msg, colon_pos);
1.11 str_append_c(ctx->name, '\0');
1.12
1.13 /* keep middle stored also in ctx->name so it's available