commit 6fd294c50f230f75c2f764148cd6005cb4a62094
parent ea54e7760f270f4f8a6666cc2315e48daf0b0110
Author: Colin Leroy <colin@colino.net>
Date: Thu, 8 Oct 2015 19:16:52 +0200
Fix null pointer dereferences and missing return checks
Diffstat:
3 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/src/etpan/imap-thread.c b/src/etpan/imap-thread.c
@@ -935,6 +935,9 @@ int imap_threaded_login(Folder * folder,
debug_print("imap login - begin\n");
+ if (!folder)
+ return MAILIMAP_ERROR_INVAL;
+
param.imap = get_imap(folder);
param.login = login;
param.password = password;
diff --git a/src/gtk/gtkcmclist.c b/src/gtk/gtkcmclist.c
@@ -7417,7 +7417,9 @@ gtk_cmclist_merge (GtkCMCList *clist,
}
}
- z.next->prev = NULL;
+ if (z.next)
+ z.next->prev = NULL;
+
return z.next;
}
diff --git a/src/imap.c b/src/imap.c
@@ -2000,8 +2000,11 @@ static gint imap_do_copy_msgs(Folder *folder, FolderItem *dest,
if (!is_dir_exist(cache_path))
make_dir_hier(cache_path);
if (is_file_exist(real_file) && is_dir_exist(cache_path)) {
- copy_file(real_file, cache_file, TRUE);
- debug_print("copied to cache: %s\n", cache_file);
+ if (copy_file(real_file, cache_file, TRUE) < 0)
+ debug_print("couldn't cache to %s: %s\n", cache_file,
+ strerror(errno));
+ else
+ debug_print("copied to cache: %s\n", cache_file);
}
g_free(real_file);
g_free(cache_file);