diff options
author | Christian Eggers <ceggers@arri.de> | 2022-09-23 16:58:12 +0200 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2022-09-23 13:42:49 -0700 |
commit | ee750bbaf68c519ab9e21e34e5b219e580a60278 (patch) | |
tree | b81591a67569729e636dd7e328668b732559179b /client | |
parent | 47346e5390bb5c8a80c05b67c345f0d7a4ec7722 (diff) | |
download | bluez-ee750bbaf68c519ab9e21e34e5b219e580a60278.tar.gz |
client/gatt: proxy_property_changed: check for NULL iterator
The passed iterator can be NULL as in
gdbus/client.c::properties_changed():
...
proxy->prop_func(..., ..., iter=NULL, ...)
+--client/gatt.c::proxy_property_changed(..., ..., iter, ...);
+--dbus_message_iter_get_arg_type(iter);
...
Diffstat (limited to 'client')
-rw-r--r-- | client/gatt.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/client/gatt.c b/client/gatt.c index efd736b23..25d593ffe 100644 --- a/client/gatt.c +++ b/client/gatt.c @@ -3003,17 +3003,20 @@ static void proxy_property_changed(GDBusProxy *proxy, const char *name, chrc->path, bt_uuidstr_to_str(chrc->uuid), name); if (!strcmp(name, "Value")) { - DBusMessageIter array; - uint8_t *value; - int len; + uint8_t *value = '\0'; /* don't pass NULL to write_value() */ + int len = 0; + + if (iter && dbus_message_iter_get_arg_type(iter) == + DBUS_TYPE_ARRAY) { + DBusMessageIter array; - if (dbus_message_iter_get_arg_type(iter) == DBUS_TYPE_ARRAY) { dbus_message_iter_recurse(iter, &array); dbus_message_iter_get_fixed_array(&array, &value, &len); - write_value(&chrc->value_len, &chrc->value, value, len, - 0, chrc->max_val_len); - bt_shell_hexdump(value, len); } + + write_value(&chrc->value_len, &chrc->value, value, len, + 0, chrc->max_val_len); + bt_shell_hexdump(value, len); } g_dbus_emit_property_changed(conn, chrc->path, CHRC_INTERFACE, name); |