Skip to content

Commit

Permalink
lib-mail: message_snippet_generate() - Fix potential crash when input…
Browse files Browse the repository at this point in the history
… ends with '>'

This happens only when the mail was large enough and full enough with
whitespace that message-parser returned multiple blocks before the snippet
was finished.

Broken by 74063ed
  • Loading branch information
sirainen authored and cmouse committed Jan 23, 2020
1 parent 3e22672 commit 3a55f35
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/lib-mail/message-snippet.c
Expand Up @@ -40,6 +40,8 @@ static void snippet_add_content(struct snippet_context *ctx,
size_t *count_r)
{
i_assert(target != NULL);
if (size == 0)
return;
if (size >= 3 &&
((data[0] == 0xEF && data[1] == 0xBB && data[2] == 0xBF) ||
(data[0] == 0xBF && data[1] == 0xBB && data[2] == 0xEF))) {
Expand Down

0 comments on commit 3a55f35

Please sign in to comment.