Commit 7c97e3d7 authored by Simon McVittie's avatar Simon McVittie Committed by Philip Withnall

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: 's avatarSimon McVittie <smcv@collabora.com>
Signed-off-by: Philip Withnall's avatarPhilip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=784392
parent c53b44ed
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment