summaryrefslogtreecommitdiff
path: root/dbind
diff options
context:
space:
mode:
authorMike Gorse <mgorse@linux-l2tz.site>2012-01-20 12:55:40 -0600
committerMike Gorse <mgorse@linux-l2tz.site>2012-01-20 12:55:40 -0600
commit5636165eec93fc20859f6e03edfa434b3e802131 (patch)
treef79d745f1bdbee08e991b4645da38f9ca2f17b9c /dbind
parent31c8d58a316909ae9db75771137bac8d53d3d2e4 (diff)
downloadat-spi2-core-5636165eec93fc20859f6e03edfa434b3e802131.tar.gz
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.
Diffstat (limited to 'dbind')
-rw-r--r--dbind/dbind.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/dbind/dbind.c b/dbind/dbind.c
index 3989bb66..c2b6f5d3 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);
}