]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Don't crash fetching body.snippet when multipart/alternative part has...
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Thu, 28 Jul 2016 18:15:16 +0000 (21:15 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Thu, 4 Aug 2016 15:12:58 +0000 (18:12 +0300)
src/lib-storage/index/index-mail.c

index 1c37e74afa36ff8aa02fb8a2903442948f80fcc0..4fd51ee4406b7870621bbd03a6bf2680727b01f6 100644 (file)
@@ -905,8 +905,10 @@ index_mail_find_first_text_mime_part(struct message_part *parts)
 
                        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;