[tests] Check for valid argument in unit test for Array
authorKalle Vahlman <kalle.vahlman@movial.com>
Thu, 23 Apr 2009 09:00:33 +0000 (12:00 +0300)
committerKalle Vahlman <kalle.vahlman@movial.com>
Thu, 23 Apr 2009 09:13:32 +0000 (12:13 +0300)
tests/unit.c

index cecd5c482ac7edb63eb11dc523c44e0b56fe9864..47ee327fae1e618c112da3c633a7314bdc446a99 100644 (file)
@@ -335,6 +335,16 @@ u_message(DBusConnection *connection, DBusMessage *message, void *user_data)
 
     dbus_message_iter_init(message, &iter);
 
+    if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_ARRAY)
+    {
+      reply = dbus_message_new_error(message,
+                                     SERVICE_NAME ".ArgError",
+                                     "Signature mismatch");
+      dbus_connection_send(connection, reply, NULL);
+      dbus_message_unref(reply);
+      return DBUS_HANDLER_RESULT_HANDLED;
+    }
+
     reply = dbus_message_new_method_return(message);
 
     dbus_message_iter_init_append(reply, &reply_iter);