D-Bus: Fix dict binarray getter to accept empty array of array

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>
This commit is contained in:
Jouni Malinen 2014-12-31 13:32:47 +02:00
parent 54e06b4ffb
commit 5f3682dc6f

View file

@ -858,13 +858,18 @@ static dbus_bool_t _wpa_dbus_dict_entry_get_binarray(
size_t buflen = 0; size_t buflen = 0;
int i; int i;
if (dbus_message_iter_get_element_type(iter) != DBUS_TYPE_BYTE)
return FALSE;
entry->array_type = WPAS_DBUS_TYPE_BINARRAY; entry->array_type = WPAS_DBUS_TYPE_BINARRAY;
entry->array_len = 0; entry->array_len = 0;
entry->binarray_value = NULL; 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) { while (dbus_message_iter_get_arg_type(iter) == DBUS_TYPE_ARRAY) {
DBusMessageIter iter_array; DBusMessageIter iter_array;