mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-18 14:48:53 +02:00
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
This commit is contained in:
committed by
Philip Withnall
parent
c53b44edb2
commit
7c97e3d784
@@ -273,6 +273,13 @@ on_name_lost_or_acquired (GDBusConnection *connection,
|
|||||||
g_strcmp0 (sender_name, "org.freedesktop.DBus") != 0)
|
g_strcmp0 (sender_name, "org.freedesktop.DBus") != 0)
|
||||||
goto out;
|
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)
|
if (g_strcmp0 (signal_name, "NameLost") == 0)
|
||||||
{
|
{
|
||||||
g_variant_get (parameters, "(&s)", &name);
|
g_variant_get (parameters, "(&s)", &name);
|
||||||
|
Reference in New Issue
Block a user