Extra check for maildir


find attached a patch that adds an extra check to maildir code. The
problem we detected in Modest is that sometimes, when reading summaries
from corrupted media, it could happen that the call to
camel_message_info_uid(mi) returns NULL. So the following call to
g_hash_table_lookup will crash due to the key being NULL.

Index: libtinymail-camel/camel-lite/camel/providers/local/camel-maildir-summary.c
--- libtinymail-camel/camel-lite/camel/providers/local/camel-maildir-summary.c	(revision 3775)
+++ libtinymail-camel/camel-lite/camel/providers/local/camel-maildir-summary.c	(working copy)
@@ -494,7 +494,7 @@
 	if (mi) {
 		char *name;
-		if (mds->priv->load_map
+		if (mds->priv->load_map && camel_message_info_uid(mi)
 		    && (name = g_hash_table_lookup(mds->priv->load_map, camel_message_info_uid(mi)))) {
 			d(printf("Setting filename of %s to %s\n", camel_message_info_uid(mi), name));
 			camel_maildir_info_set_filename(mi, g_strdup(name));

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]