From 508837e37585ebc32fe5bc454f0ad98a84da9f40 Mon Sep 17 00:00:00 2001 From: Sebastian Wick Date: Wed, 27 Nov 2024 11:41:01 +0100 Subject: [PATCH] app-info/host: Only use the cgroup app id if we have a matching GAppInfo This should prevent cases where the connection is from something that's not actually an app but follows the systemd cgroup standard. This is safe because * it's a host app anyway * we always use an empty app id when x-d-p is built without systemd * it's the default when the systemd cgroup standard is not followed --- src/xdp-app-info-host.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/xdp-app-info-host.c b/src/xdp-app-info-host.c index 9b7a1f80d..b94216d13 100644 --- a/src/xdp-app-info-host.c +++ b/src/xdp-app-info-host.c @@ -197,6 +197,12 @@ xdp_app_info_host_new (int pid, desktop_id = g_strconcat (appid, ".desktop", NULL); gappinfo = G_APP_INFO (g_desktop_app_info_new (desktop_id)); + if (!gappinfo) + { + g_clear_pointer (&desktop_id, g_free); + desktop_id = g_strdup (""); + } + app_info_host = g_object_new (XDP_TYPE_APP_INFO_HOST, NULL); xdp_app_info_initialize (XDP_APP_INFO (app_info_host), /* engine, app id, instance */