[BlueZ 2/2] adv_monitor: Ignore additional patterns past what's supported

Bastien Nocera <[email protected]>
Newsgroups org.kernel.vger.linux-bluetooth
Message-ID <[email protected]>
Ignore patterns beyond what the adapter supports.

Suggested-by: Aisle Research
---
 src/adv_monitor.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/adv_monitor.c b/src/adv_monitor.c
index 7f437a0e7c8f..c7de01f72a26 100644
--- a/src/adv_monitor.c
+++ b/src/adv_monitor.c
@@ -889,6 +889,7 @@ static bool parse_patterns(struct adv_monitor *monitor, const char *path)
 {
 	DBusMessageIter array, array_iter;
 	uint16_t adapter_id = monitor->app->manager->adapter_id;
+	uint8_t max_num_patterns = monitor->app->manager->max_num_patterns;
 
 	if (!g_dbus_proxy_get_property(monitor->proxy, "Patterns", &array)) {
 		btd_error(adapter_id,
@@ -950,6 +951,10 @@ static bool parse_patterns(struct adv_monitor *monitor, const char *path)
 
 		queue_push_tail(monitor->merged_pattern->patterns, pattern);
 
+		if (queue_length(monitor->merged_pattern->patterns) >=
+			max_num_patterns)
+			break;
+
 		dbus_message_iter_next(&array_iter);
 	}
 
-- 
2.55.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.