Skip to content

Commit

Permalink
lib-storage: Fix truncating header values at NUL when adding to cache
Browse files Browse the repository at this point in the history
For example FETCH BODY.PEEK[HEADER.FIELDS (Subject)] could have returned
the NUL on the first fetch when the mail wasn't in dovecot.index.cache,
but the second FETCH would have returned it truncated at the NUL.
  • Loading branch information
sirainen committed Aug 30, 2018
1 parent 600d85e commit f39f0a1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib-storage/index/index-mail-headers.c
Expand Up @@ -346,7 +346,7 @@ void index_mail_parse_header(struct message_part *part,
cache as nonexistent. */
match[field_idx] |= HEADER_MATCH_FLAG_FOUND;
}
str_append_n(mail->header_data, hdr->value, hdr->value_len);
str_append_data(mail->header_data, hdr->value, hdr->value_len);
if (!hdr->no_newline)
str_append(mail->header_data, "\n");
if (!hdr->continues) {
Expand Down

0 comments on commit f39f0a1

Please sign in to comment.