From 1635998ac3482abf6153f857e8a16c8b8cf85158 Mon Sep 17 00:00:00 2001 From: "Geyslan G. Bem" Date: Tue, 27 Apr 2021 11:42:55 -0300 Subject: [PATCH 1/2] gtkplacessidebar.c: add bookmark null checking This fixes nautilus crash and perhaps other callers issues. Nautilus (and sometimes glib) crashes with malformed URI inside of the bookmarks file .config/gtk-3.0/bookmarks when it has no LABEL. This is result from the closed glib MR #2065 analysis and agreement. https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2065#note_1091979 Signed-off-by: Geyslan G. Bem --- gtk/gtkplacessidebar.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gtk/gtkplacessidebar.c b/gtk/gtkplacessidebar.c index 43f03069d8..c57031be07 100644 --- a/gtk/gtkplacessidebar.c +++ b/gtk/gtkplacessidebar.c @@ -795,6 +795,10 @@ on_bookmark_query_info_complete (GObject *source, { /* Don't add non-UTF-8 bookmarks */ bookmark_name = g_file_get_basename (root); + if (bookmark_name == NULL) + { + goto out; + } if (!g_utf8_validate (bookmark_name, -1, NULL)) { g_free (bookmark_name); From 65575fe0d00e5f63a062c475a75844510da0fd42 Mon Sep 17 00:00:00 2001 From: "Geyslan G. Bem" Date: Wed, 28 Apr 2021 08:42:59 -0300 Subject: [PATCH 2/2] gtkplacessidebar.c: fix coding style Signed-off-by: Geyslan G. Bem --- gtk/gtkplacessidebar.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/gtk/gtkplacessidebar.c b/gtk/gtkplacessidebar.c index c57031be07..ff29383f22 100644 --- a/gtk/gtkplacessidebar.c +++ b/gtk/gtkplacessidebar.c @@ -796,9 +796,8 @@ on_bookmark_query_info_complete (GObject *source, /* Don't add non-UTF-8 bookmarks */ bookmark_name = g_file_get_basename (root); if (bookmark_name == NULL) - { - goto out; - } + goto out; + if (!g_utf8_validate (bookmark_name, -1, NULL)) { g_free (bookmark_name);