diff options
author | Simon McVittie <smcv@collabora.com> | 2017-06-19 12:47:50 +0100 |
---|---|---|
committer | Philip Withnall <withnall@endlessm.com> | 2017-08-07 17:31:31 +0100 |
commit | 7c97e3d784f7243d6a426f1c5659cbccc6acb139 (patch) | |
tree | 63f10b820b989cba0d0060be2f489c76b77f4959 | |
parent | c53b44edb28b7aec62349a11a8263c488b35b70e (diff) |
gdbus: Check signature of NameAcquired, NameLost
Calling g_variant_get (parameters, "(&s)") when parameters has a
signature other than (s) is considered to be a programming error.
In practice the message bus (dbus-daemon or a reimplementation) should
always send the expected type, but be defensive.
(Modified by Philip Withnall to improve type check.)
Signed-off-by: Simon McVittie <smcv@collabora.com>
Signed-off-by: Philip Withnall <withnall@endlessm.com>
https://bugzilla.gnome.org/show_bug.cgi?id=784392
-rw-r--r-- | gio/gdbusnameowning.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/gio/gdbusnameowning.c b/gio/gdbusnameowning.c index fcfc2f4fe..2c2714db2 100644 --- a/gio/gdbusnameowning.c +++ b/gio/gdbusnameowning.c @@ -273,6 +273,13 @@ on_name_lost_or_acquired (GDBusConnection *connection, g_strcmp0 (sender_name, "org.freedesktop.DBus") != 0) goto out; + if (!g_variant_is_of_type (parameters, G_VARIANT_TYPE ("(s)"))) + { + g_warning ("%s signal had unexpected signature %s", signal_name, + g_variant_get_type_string (parameters)); + goto out; + } + if (g_strcmp0 (signal_name, "NameLost") == 0) { g_variant_get (parameters, "(&s)", &name); |