Browse Source

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>
Jouni Malinen 10 years ago
parent
commit
5f3682dc6f
1 changed files with 8 additions and 3 deletions
  1. 8 3
      wpa_supplicant/dbus/dbus_dict_helpers.c

+ 8 - 3
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;