[Xfce4-commits] <xfce4-settings:master> Fix possible NULL values (bug #6119 #6120)

Jérôme Guelfucci noreply at xfce.org
Thu Jan 7 10:32:01 CET 2010


Updating branch refs/heads/master
         to a708e6281a4f3d8047d0c63c622538c1f554eff3 (commit)
       from 350b0364dcbb39674d7390d9586db5efc154391a (commit)

commit a708e6281a4f3d8047d0c63c622538c1f554eff3
Author: Mike Massonnet <mmassonnet at xfce.org>
Date:   Thu Jan 7 00:21:39 2010 +0100

    Fix possible NULL values (bug #6119 #6120)
    
    As reported in xfce4-clipman there is a possible crash when the default
    cache is used to restore content or fill the selection while it is NULL.

 xfce4-settings-helper/clipboard-manager.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/xfce4-settings-helper/clipboard-manager.c b/xfce4-settings-helper/clipboard-manager.c
index cf23f25..d214dbe 100644
--- a/xfce4-settings-helper/clipboard-manager.c
+++ b/xfce4-settings-helper/clipboard-manager.c
@@ -136,7 +136,7 @@ xfce_clipboard_manager_default_get_func (GtkClipboard     *clipboard,
 
     list = manager->default_cache;
 
-    for (; list->next != NULL; list = list->next)
+    for (; list != NULL && list->next != NULL; list = list->next)
     {
         selection_data_cache = list->data;
 
@@ -178,9 +178,13 @@ xfce_clipboard_manager_default_restore (XfceClipboardManager *manager)
 
     g_return_if_fail (XFCE_IS_CLIPBOARD_MANAGER (manager));
 
+    list = manager->default_cache;
+    if (list == NULL)
+      return;
+
     target_list = gtk_target_list_new (NULL, 0);
 
-    for (list = manager->default_cache; list->next != NULL; list = list->next)
+    for (; list->next != NULL; list = list->next)
     {
         sdata = list->data;
         gtk_target_list_add (target_list,



More information about the Xfce4-commits mailing list