From 2f111286741eab0665b33f4d6ab985e3c8cc2ea8 Mon Sep 17 00:00:00 2001 From: Alistair Buxton Date: Mon, 30 Sep 2013 23:35:40 +0100 Subject: [PATCH] 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); -- 1.8.3.2