changeset 20541:0bdffed7f6ef

lib-storage: Don't crash fetching body.snippet when multipart/alternative part has no Content-Type
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Thu, 28 Jul 2016 21:15:16 +0300
parents 4ea94770b30c
children 37e2fcca9e0f
files src/lib-storage/index/index-mail.c
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/index-mail.c	Tue Jul 26 13:53:56 2016 -0400
+++ b/src/lib-storage/index/index-mail.c	Thu Jul 28 21:15:16 2016 +0300
@@ -905,8 +905,10 @@
 
 			i_assert(sub_body_data != NULL);
 
-			if (strcasecmp(sub_body_data->content_type, "\"text\"") == 0) {
-				if (strcasecmp(sub_body_data->content_subtype, "\"plain\"") == 0)
+			if (sub_body_data->content_type == NULL ||
+			    strcasecmp(sub_body_data->content_type, "\"text\"") == 0) {
+				if (sub_body_data->content_subtype == NULL ||
+				    strcasecmp(sub_body_data->content_subtype, "\"plain\"") == 0)
 					return part;
 				if (strcasecmp(sub_body_data->content_subtype, "\"html\"") == 0)
 					html_part = part;