[Xfce4-commits] <garcon:master> Bail out of creating a directory menu if it doesn't have a name.

Nick Schermer noreply at xfce.org
Sat Dec 7 12:26:01 CET 2013


Updating branch refs/heads/master
         to 48cc0b0e37d61d68c4889e236add390843fa01d6 (commit)
       from 166dbf25587a257c163fb7e55038266cbb5c8343 (commit)

commit 48cc0b0e37d61d68c4889e236add390843fa01d6
Author: Alistair Buxton <a.j.buxton at gmail.com>
Date:   Mon Sep 30 23:35:40 2013 +0100

    Bail out of creating a directory menu if it doesn't have a name.
    
    Attempting to create a directory menu with no name will cause a
    segfault later when the name is validated.

 garcon/garcon-menu-directory.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/garcon/garcon-menu-directory.c b/garcon/garcon-menu-directory.c
index 4b35863..deb62ba 100644
--- a/garcon/garcon-menu-directory.c
+++ b/garcon/garcon-menu-directory.c
@@ -361,6 +361,11 @@ garcon_menu_directory_new (GFile *file)
 
   /* Parse name, exec command and icon name */
   name = xfce_rc_read_entry (rc, G_KEY_FILE_DESKTOP_KEY_NAME, NULL);
+
+  /* If there is no name we must bail out now or segfault later */
+  if (G_UNLIKELY (name == NULL))
+    return NULL;
+
   comment = xfce_rc_read_entry (rc, G_KEY_FILE_DESKTOP_KEY_COMMENT, NULL);
   icon_name = xfce_rc_read_entry_untranslated (rc, G_KEY_FILE_DESKTOP_KEY_ICON, NULL);
   no_display = xfce_rc_read_bool_entry (rc, G_KEY_FILE_DESKTOP_KEY_NO_DISPLAY, FALSE);


More information about the Xfce4-commits mailing list