diff mbox series

[BlueZ,3/9] advertising: parse_secondary: check for NULL iterator

Message ID 20220923102421.10336-4-ceggers@arri.de (mailing list archive)
State Superseded
Headers show
Series properties_changed: check for NULL iterator | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/checkpatch success Checkpatch PASS
tedd_an/gitlint success Gitlint PASS

Commit Message

Christian Eggers Sept. 23, 2022, 10:24 a.m. UTC
The passed iterator can be NULL as in
gdbus/client.c::properties_changed():
...
   proxy->prop_func(..., ..., iter=NULL, ...)
   +--src/advertising.c::properties_changed(..., ..., iter, ...);
      +--parse_secondary(iter, ...);
...
---
 src/advertising.c | 6 ++++++
 1 file changed, 6 insertions(+)
diff mbox series

Patch

diff --git a/src/advertising.c b/src/advertising.c
index 42ac627604fe..6d8d06edd34f 100644
--- a/src/advertising.c
+++ b/src/advertising.c
@@ -1047,6 +1047,12 @@  static bool parse_secondary(DBusMessageIter *iter,
 	const char *str;
 	struct adv_secondary *sec;
 
+	if (!iter) {
+		/* Reset secondary channels */
+		client->flags &= ~MGMT_ADV_FLAG_SEC_MASK;
+		return true;
+	}
+
 	if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_STRING)
 		return false;