[gnome-software: 1/2] GsApplication: Crash when run as root




commit 507884bb8eaa22ae9a639673ae23005200b96ba2
Author: Milan Crha <mcrha redhat com>
Date:   Mon Feb 22 11:45:20 2021 +0000

    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 | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/src/gs-application.c b/src/gs-application.c
index 0117a4e0d..a1939ae8b 100644
--- a/src/gs-application.c
+++ b/src/gs-application.c
@@ -50,7 +50,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;
@@ -920,7 +920,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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]