[dovecot-cvs] dovecot/src/lib-imap imap-bodystructure.c,1.18,1.19

cras at procontrol.fi cras at procontrol.fi
Fri Nov 22 10:37:11 EET 2002


Update of /home/cvs/dovecot/src/lib-imap
In directory danu:/tmp/cvs-serv16394

Modified Files:
	imap-bodystructure.c 
Log Message:
handle broken multipart messages without crashing



Index: imap-bodystructure.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-imap/imap-bodystructure.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- imap-bodystructure.c	6 Nov 2002 07:46:55 -0000	1.18
+++ imap-bodystructure.c	22 Nov 2002 08:37:06 -0000	1.19
@@ -246,7 +246,10 @@
 {
 	MessagePartBodyData *data = part->context;
 
-	i_assert(data != NULL);
+	if (data == NULL) {
+		/* there was no content headers, use an empty structure */
+		data = t_new(MessagePartBodyData, 1);
+	}
 
 	if (part->children != NULL)
 		part_write_bodystructure(part->children, str, extended);
@@ -258,7 +261,10 @@
 	}
 
 	t_string_append_c(str, ' ');
-	t_string_append(str, data->content_subtype);
+	if (data->content_subtype != NULL)
+		t_string_append(str, data->content_subtype);
+	else
+		t_string_append(str, "x-unknown");
 
 	if (!extended)
 		return;




More information about the dovecot-cvs mailing list