From 5f3682dc6f3959cb2e1693a0ec64745696dfc7bc Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Wed, 31 Dec 2014 13:32:47 +0200 Subject: [PATCH] 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 --- wpa_supplicant/dbus/dbus_dict_helpers.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) 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;