File gnome-session-bsc982938-invalid-utf8-in-env-vars.patch of Package gnome-session.2960
From 1238616b947ff762b6c70680de51b18353ad7283 Mon Sep 17 00:00:00 2001
From: Federico Mena Quintero <federico@gnome.org>
Date: Wed, 20 Jul 2016 19:25:46 -0500
Subject: [PATCH] bsc#982938 - Ensure that values in environment variables are
valid UTF-8
Otherwise the D-Bus machinery will refuse to pass them on. On the other end,
systemd doesn't have support for non-UTF-8 locales anyway.
---
gnome-session/gsm-util.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/gnome-session/gsm-util.c b/gnome-session/gsm-util.c
index a2fe354..ccee8de 100644
--- a/gnome-session/gsm-util.c
+++ b/gnome-session/gsm-util.c
@@ -486,10 +486,12 @@ gsm_util_update_activation_environment (const char *variable,
DBusGProxy *bus_proxy;
GHashTable *environment;
gboolean environment_updated;
+ char *utf8_value;
environment_updated = FALSE;
bus_proxy = NULL;
environment = NULL;
+ utf8_value = NULL;
dbus_connection = dbus_g_bus_get (DBUS_BUS_SESSION, error);
@@ -509,14 +511,20 @@ gsm_util_update_activation_environment (const char *variable,
environment = g_hash_table_new (g_str_hash, g_str_equal);
- g_hash_table_insert (environment, (void *) variable, (void *) value);
+ utf8_value = g_locale_to_utf8 (value, -1, NULL, NULL, error);
+ if (!utf8_value) {
+ goto out;
+ }
+
+ g_hash_table_insert (environment, (void *) variable, (void *) utf8_value);
if (!dbus_g_proxy_call (bus_proxy,
"UpdateActivationEnvironment", error,
DBUS_TYPE_G_STRING_STRING_HASHTABLE,
environment, G_TYPE_INVALID,
- G_TYPE_INVALID))
+ G_TYPE_INVALID)) {
goto out;
+ }
environment_updated = TRUE;
@@ -524,6 +532,9 @@ gsm_util_update_activation_environment (const char *variable,
g_clear_object (&bus_proxy);
+ if (utf8_value != NULL)
+ g_free (utf8_value);
+
if (environment != NULL) {
g_hash_table_destroy (environment);
}
--
2.1.4