Skip to content

Commit

Permalink
lib-mail: If message_part_data.content_type is set, make sure content…
Browse files Browse the repository at this point in the history
…_subtype isn't NULL

This fixes a crash in index_mail_find_first_text_mime_part() where snippet
generation assumed that content_subtype isn't NULL.
  • Loading branch information
sirainen authored and villesavolainen committed Jan 25, 2019
1 parent 5e5eda6 commit 41bd7fb
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/lib-mail/message-part-data.c
Expand Up @@ -295,6 +295,12 @@ parse_content_type(struct message_part_data *data,
}
str_truncate(str, i);
data->content_type = p_strdup(pool, str_c(str));
if (data->content_subtype == NULL) {
/* The Content-Type is invalid. Don't leave it NULL so that
callers can assume that if content_type != NULL,
content_subtype != NULL also. */
data->content_subtype = p_strdup(pool, "");
}

if (ret < 0) {
/* Content-Type is broken, but we wanted to get it as well as
Expand Down

0 comments on commit 41bd7fb

Please sign in to comment.