Linux bluetooth development
 help / color / mirror / Atom feed
From: Bastien Nocera <hadess@hadess.net>
To: linux-bluetooth@vger.kernel.org
Subject: [BlueZ 2/2] adv_monitor: Ignore additional patterns past what's supported
Date: Thu, 13 Aug 2026 11:16:58 +0200	[thread overview]
Message-ID: <20260813091937.2600061-3-hadess@hadess.net> (raw)
In-Reply-To: <20260813091937.2600061-1-hadess@hadess.net>

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


      parent reply	other threads:[~2026-08-13  9:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-13  9:16 [BlueZ 0/2] adv_monitor: Fix buffer overflow caused by integer overflow Bastien Nocera
2026-08-13  9:16 ` [BlueZ 1/2] " Bastien Nocera
2026-08-13 10:30   ` bluez.test.bot
2026-08-13  9:16 ` Bastien Nocera [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260813091937.2600061-3-hadess@hadess.net \
    --to=hadess@hadess.net \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox