Mercurial > dovecot > core-2.2
changeset 22985:e4a91ec695bb
lib-mail: If message_part_data.content_type is set, make sure content_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.
author | Timo Sirainen <timo.sirainen@dovecot.fi> |
---|---|
date | Tue, 24 Jul 2018 14:55:25 +0300 |
parents | d62b238d7d66 |
children | 7009c54d937f |
files | src/lib-mail/message-part-data.c |
diffstat | 1 files changed, 6 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-mail/message-part-data.c Mon Aug 06 12:39:25 2018 +0300 +++ b/src/lib-mail/message-part-data.c Tue Jul 24 14:55:25 2018 +0300 @@ -295,6 +295,12 @@ } 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