gnome-software/SOURCES/crash-when-run-as-root.patch

58 lines
1.7 KiB
Diff

From 98dbef8b5a547d3d920d377022e20d2e63519b2f Mon Sep 17 00:00:00 2001
From: Milan Crha <mcrha@redhat.com>
Date: Tue, 16 Feb 2021 12:58:19 +0100
Subject: [PATCH 1/2] GsApplication: Crash when run as root
The `search_provider` is not initialized in this case, leading
to NULL dereference. Skip the call in such cases, because the search
provider is not that important.
Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1142
---
src/gs-application.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/gs-application.c b/src/gs-application.c
index 48f0c6aac..fdb5f55c4 100644
--- a/src/gs-application.c
+++ b/src/gs-application.c
@@ -912,7 +912,8 @@ static void
gs_application_setup_search_provider (GsApplication *app)
{
gs_application_initialize_plugins (app);
- gs_shell_search_provider_setup (app->search_provider, app->plugin_loader);
+ if (app->search_provider)
+ gs_shell_search_provider_setup (app->search_provider, app->plugin_loader);
}
static void
--
GitLab
From 0055bfa8535bb7c5ccd9ace244d71b2885a47daa Mon Sep 17 00:00:00 2001
From: Philip Withnall <philip@tecnocode.co.uk>
Date: Mon, 22 Feb 2021 11:41:05 +0000
Subject: [PATCH 2/2] Apply 1 suggestion(s) to 1 file(s)
---
src/gs-application.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/gs-application.c b/src/gs-application.c
index fdb5f55c4..f05f6f718 100644
--- a/src/gs-application.c
+++ b/src/gs-application.c
@@ -49,7 +49,7 @@ struct _GsApplication {
#ifdef HAVE_PACKAGEKIT
GsDbusHelper *dbus_helper;
#endif
- GsShellSearchProvider *search_provider;
+ GsShellSearchProvider *search_provider; /* (nullable) (owned) */
GSettings *settings;
GSimpleActionGroup *action_map;
guint shell_loaded_handler_id;
--
GitLab