From: Jouni Malinen Date: Wed, 31 Dec 2014 11:32:47 +0000 (+0200) Subject: D-Bus: Fix dict binarray getter to accept empty array of array X-Git-Tag: hostap_2_4~607 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5f3682dc6f3959cb2e1693a0ec64745696dfc7bc;p=thirdparty%2Fhostap.git 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 --- diff --git a/wpa_supplicant/dbus/dbus_dict_helpers.c b/wpa_supplicant/dbus/dbus_dict_helpers.c index 034b751c4..0020a8524 100644 --- a/wpa_supplicant/dbus/dbus_dict_helpers.c +++ b/wpa_supplicant/dbus/dbus_dict_helpers.c @@ -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;