]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
D-Bus: Fix dict binarray getter to accept empty array of array
authorJouni Malinen <j@w1.fi>
Wed, 31 Dec 2014 11:32:47 +0000 (13:32 +0200)
committerJouni Malinen <j@w1.fi>
Wed, 31 Dec 2014 11:34:52 +0000 (13:34 +0200)
This is needed to allow Set(P2PDeviceConfig) to clear the
VendorExtension array (i.e., to remove all configured vendor
extensions). Previously, such an attempt was met with a D-Bus assert and
rejection of the operation.

Signed-off-by: Jouni Malinen <j@w1.fi>
wpa_supplicant/dbus/dbus_dict_helpers.c

index 034b751c4c33d0e65bd4e04e2608d3e66c1fa410..0020a85247fabf1e04bf0f83508c1c2e29841e2f 100644 (file)
@@ -858,13 +858,18 @@ static dbus_bool_t _wpa_dbus_dict_entry_get_binarray(
        size_t buflen = 0;
        int i;
 
-       if (dbus_message_iter_get_element_type(iter) != DBUS_TYPE_BYTE)
-               return FALSE;
-
        entry->array_type = WPAS_DBUS_TYPE_BINARRAY;
        entry->array_len = 0;
        entry->binarray_value = NULL;
 
+       if (dbus_message_iter_get_arg_type(iter) == DBUS_TYPE_INVALID) {
+               /* Likely an empty array of arrays */
+               return TRUE;
+       }
+
+       if (dbus_message_iter_get_element_type(iter) != DBUS_TYPE_BYTE)
+               return FALSE;
+
        while (dbus_message_iter_get_arg_type(iter) == DBUS_TYPE_ARRAY) {
                DBusMessageIter iter_array;