From 5636165eec93fc20859f6e03edfa434b3e802131 Mon Sep 17 00:00:00 2001 From: Mike Gorse Date: Fri, 20 Jan 2012 12:55:40 -0600 Subject: [PATCH] Have dbind_method_call_reentrant_va check the signature of replies When making a method call, we should check that the signature of the reply matches what we expect and throw an error if not. Otherwise we may crash. --- dbind/dbind.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/dbind/dbind.c b/dbind/dbind.c index 3989bb6..c2b6f5d 100644 --- a/dbind/dbind.c +++ b/dbind/dbind.c @@ -153,6 +153,17 @@ dbind_method_call_reentrant_va (DBusConnection *cnx, { DBusMessageIter iter; dbus_message_iter_init (reply, &iter); + if (strcmp (p + 2, dbus_message_get_signature (reply)) != 0) + { + g_warning ("dbind: Call to \"%s\" returned signature %s; expected %s", + method, p + 2, dbus_message_get_signature (reply)); + if (opt_error) + dbus_set_error (opt_error, DBUS_ERROR_INVALID_ARGS, + "Call to \"%s\" returned signature %s; expected %s", + method, p + 2, + dbus_message_get_signature (reply)); + goto out; + } p = arg_types; dbind_any_demarshal_va (&iter, &p, args_demarshal); } -- 2.7.4