[at-spi2-core] Have dbind_method_call_reentrant_va check the signature of replies



commit 5636165eec93fc20859f6e03edfa434b3e802131
Author: Mike Gorse <mgorse linux-l2tz site>
Date:   Fri Jan 20 12:55:40 2012 -0600

    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 files changed, 11 insertions(+), 0 deletions(-)
---
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);
     }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]