diff options
author | Simon McVittie <smcv@collabora.com> | 2022-07-14 16:43:57 +0100 |
---|---|---|
committer | Philip Withnall <pwithnall@endlessos.org> | 2022-07-25 01:00:53 +0200 |
commit | 8157668eacd69312cfa954218a6362e897450bf1 (patch) | |
tree | bb4090e850823a131ce52e9a09d1640697877442 | |
parent | e4e21f20e2539a43d3c01af2443b6d4d141d6593 (diff) | |
download | glib-8157668eacd69312cfa954218a6362e897450bf1.tar.gz |
gdesktopappinfo: Don't trust $GIO_LAUNCH_DESKTOP if setuid
gio-launch-desktop was removed before checking GIO for potentially
unsafe environment variable references, so reverting its removal brought
this one back. If a setuid program is using GAppInfo then something is
probably already horribly wrong, but let's be careful anyway.
Signed-off-by: Simon McVittie <smcv@collabora.com>
-rw-r--r-- | gio/gdesktopappinfo.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/gio/gdesktopappinfo.c b/gio/gdesktopappinfo.c index 20cf2af8c..4813425ac 100644 --- a/gio/gdesktopappinfo.c +++ b/gio/gdesktopappinfo.c @@ -51,6 +51,7 @@ #include "gfileicon.h" #include <glib/gstdio.h> #include "glibintl.h" +#include "glib-private.h" #include "giomodule-priv.h" #include "gappinfo.h" #include "gappinfoprivate.h" @@ -2918,10 +2919,12 @@ g_desktop_app_info_launch_uris_with_spawn (GDesktopAppInfo *info, if (g_once_init_enter (&gio_launch_desktop_path)) { - const gchar *tmp; + const gchar *tmp = NULL; + gboolean is_setuid = GLIB_PRIVATE_CALL (g_check_setuid) (); /* Allow test suite to specify path to gio-launch-desktop */ - tmp = g_getenv ("GIO_LAUNCH_DESKTOP"); + if (!is_setuid) + tmp = g_getenv ("GIO_LAUNCH_DESKTOP"); /* Fall back on usual searching in $PATH */ if (tmp == NULL) |