Fix null pointer dereferences and missing return checks
authorColin Leroy <colin@colino.net>
Thu, 8 Oct 2015 17:16:52 +0000 (19:16 +0200)
committerColin Leroy <colin@colino.net>
Thu, 8 Oct 2015 17:16:52 +0000 (19:16 +0200)
src/etpan/imap-thread.c
src/gtk/gtkcmclist.c
src/imap.c

index f1c555d3ebe43adf188e77bab30be4229c9ad96d..ffe05987e1c292e9cf4eff0836319e448dd98ab9 100644 (file)
@@ -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;
index 737b2787ebd7568393a08c8cbf2f719cf76aef22..e58f8c565c7b7269c97ffc3c286f06898c4b8e01 100644 (file)
@@ -7417,7 +7417,9 @@ gtk_cmclist_merge (GtkCMCList *clist,
        }
     }
 
-  z.next->prev = NULL;
+  if (z.next)
+       z.next->prev = NULL;
+
   return z.next;
 }
 
index ad476ffc525fe0864c2b99c5706b9f816a51c125..79b1a897218f0189296331948c73830b33857d81 100644 (file)
@@ -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);