On Thu, 2019-08-22 at 21:43 +0200, István Bodnár wrote: > In case wpa_supplicant receive empty byte array via dbus > (e.g.: from Network Manager which sends empty private key password > field) > it will use the "NULL" default value. Any idea which NM versions send this? NM should get fixed to not do this if it's a problem. Dan > Signed-off-by: Istvan Bodnar <mail.bodnaristvan@xxxxxxxxx> > --- > wpa_supplicant/dbus/dbus_new_handlers.c | 18 +++++++++++++----- > 1 file changed, 13 insertions(+), 5 deletions(-) > > diff --git a/wpa_supplicant/dbus/dbus_new_handlers.c > b/wpa_supplicant/dbus/dbus_new_handlers.c > index 6c36d91a0..45c16c2e7 100644 > --- a/wpa_supplicant/dbus/dbus_new_handlers.c > +++ b/wpa_supplicant/dbus/dbus_new_handlers.c > @@ -206,17 +206,25 @@ dbus_bool_t set_network_properties(struct > wpa_supplicant *wpa_s, > value = NULL; > if (entry.type == DBUS_TYPE_ARRAY && > entry.array_type == DBUS_TYPE_BYTE) { > - if (entry.array_len <= 0) > + if (entry.array_len < 0) > goto error; > + if (entry.array_len == 0) > + size = strlen("NULL") + 3; > + else > + size = entry.array_len * 2 + 1; > > - size = entry.array_len * 2 + 1; > value = os_zalloc(size); > if (value == NULL) > goto error; > > - ret = wpa_snprintf_hex(value, size, > - (u8 *) > entry.bytearray_value, > - entry.array_len); > + if (entry.array_len == 0) > + ret = os_snprintf(value, size, > "\"%s\"", > + "NULL"); > + else > + ret = wpa_snprintf_hex(value, size, > + (u8 *) > entry.bytearray_value, > + entry.array_le > n); > + > if (ret <= 0) > goto error; > } else if (entry.type == DBUS_TYPE_STRING) { > _______________________________________________ > Hostap mailing list > Hostap@xxxxxxxxxxxxxxxxxxx > http://lists.infradead.org/mailman/listinfo/hostap _______________________________________________ Hostap mailing list Hostap@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/hostap