From: Roland Schober <rolandschober1968@gmail.com>
To: linux-bluetooth@vger.kernel.org
Cc: Roland Schober <rolandschober1968@gmail.com>
Subject: [PATCH BlueZ 2/5] monitor: Fix reading Flags beyond empty AD structures
Date: Fri, 20 Nov 2026 23:26:21 +0100 [thread overview]
Message-ID: <20261120222624.150321-3-rolandschober1968@gmail.com> (raw)
In-Reply-To: <20261120222624.150321-1-rolandschober1968@gmail.com>
print_eir() reads the first data octet of the Flags and of the Security
Manager OOB Flags without checking that there is one. An AD structure
which only has its type, at the end of the advertising data, makes it
read one octet beyond the data.
Fixes: 854c945433fc ("monitor: Add full EIR parsing support")
Assisted-by: Claude:claude-fable-5-2
---
monitor/packet.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/monitor/packet.c b/monitor/packet.c
index bce3bb819..4f63cc0fb 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -4437,6 +4437,8 @@ static void print_eir(const char *label, const uint8_t *eir, uint8_t eir_len,
switch (eir[1]) {
case BT_EIR_FLAGS:
+ if (data_len < 1)
+ break;
flags = *data;
print_field("Flags: 0x%2.2x", flags);
@@ -4534,6 +4536,8 @@ static void print_eir(const char *label, const uint8_t *eir, uint8_t eir_len,
break;
case BT_EIR_SMP_OOB_FLAGS:
+ if (data_len < 1)
+ break;
print_field("SMP OOB Flags: 0x%2.2x", *data);
break;
--
2.47.3
next prev parent reply other threads:[~2026-11-20 22:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-20 22:26 [PATCH BlueZ 0/5] monitor: Fix reads beyond advertising data Roland Schober
2026-11-20 22:26 ` [PATCH BlueZ 1/5] monitor: Fix overflow of the name buffer in print_eir Roland Schober
2026-11-20 22:26 ` Roland Schober [this message]
2026-11-20 22:26 ` [PATCH BlueZ 3/5] monitor: Fix reading beyond a short Mesh Beacon Roland Schober
2026-11-20 22:26 ` [PATCH BlueZ 4/5] monitor: Fix reading beyond the Apple manufacturer data Roland Schober
2026-11-20 22:26 ` [PATCH BlueZ 5/5] monitor: Fix decoding of Public Broadcast Announcements Roland Schober
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=20261120222624.150321-3-rolandschober1968@gmail.com \
--to=rolandschober1968@gmail.com \
--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