2008-07-25 Mark Doffman <mark.doffman@codethink.co.uk>
authorMark Doffman <mdoff@silver-wind.(none)>
Fri, 25 Jul 2008 13:37:27 +0000 (14:37 +0100)
committerMark Doffman <mdoff@silver-wind.(none)>
Fri, 25 Jul 2008 13:37:27 +0000 (14:37 +0100)
* dbind/dbind.c
Add some checks for the method call method.
Check destination is not null, this otherwise
caused a segfault.

This fixes the dbind unit tests.

dbind/dbind.c

index 39b0240..1bbf0b0 100644 (file)
@@ -137,6 +137,7 @@ dbind_connection_method_call_va (DBusConnection *cnx,
     DBusMessage *msg = NULL, *reply = NULL;
     DBusError *err, real_err;
     char *p;
+    char *dest;
 
     if (opt_error)
         err = opt_error;
@@ -211,7 +212,10 @@ dbind_connection_method_call_va (DBusConnection *cnx,
             }
     }
 
-    if (!strcmp (dbus_bus_get_unique_name(cnx), dbus_message_get_destination(msg)))
+    dest = dbus_message_get_destination(msg);
+    if (!dest)
+        goto out;
+    if (!strcmp (dbus_bus_get_unique_name(cnx), dest))
     {
       /* Can't use dbus_message_send_with_reply_and_block because it will
        * not pass messages on to the provider side, causing deadlock */