From: Roland Schober <rolandschober1968@gmail.com>
To: linux-bluetooth@vger.kernel.org
Cc: Roland Schober <rolandschober1968@gmail.com>
Subject: [PATCH BlueZ 4/5] monitor: Fix reading beyond the Apple manufacturer data
Date: Fri, 20 Nov 2026 23:26:23 +0100 [thread overview]
Message-ID: <20261120222624.150321-5-rolandschober1968@gmail.com> (raw)
In-Reply-To: <20261120222624.150321-1-rolandschober1968@gmail.com>
print_manufacturer_apple() reads the type before it checks that there
is one, and prints the identifier as a string although nothing
terminates it, so up to 98 octets which follow the AD structure are
printed with it.
Check the length first and print the identifier with its length.
Fixes: 35b0d0c7c281 ("monitor: Decode Apple identifier and iBeacon data structures")
Assisted-by: Claude:claude-fable-5-2
---
monitor/packet.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/monitor/packet.c b/monitor/packet.c
index 6646dc147..042a2ecb6 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -3763,18 +3763,16 @@ static void print_fec(uint8_t fec)
static void print_manufacturer_apple(const void *data, uint8_t data_len)
{
- uint8_t type = *((uint8_t *) data);
+ uint8_t type;
if (data_len < 1)
return;
- if (type == 0x01) {
- char identifier[100];
+ type = *((uint8_t *) data);
- snprintf(identifier, sizeof(identifier) - 1, "%s",
+ if (type == 0x01) {
+ print_field(" Identifier: %.*s", data_len - 1,
(const char *) (data + 1));
-
- print_field(" Identifier: %s", identifier);
return;
}
--
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 ` [PATCH BlueZ 2/5] monitor: Fix reading Flags beyond empty AD structures Roland Schober
2026-11-20 22:26 ` [PATCH BlueZ 3/5] monitor: Fix reading beyond a short Mesh Beacon Roland Schober
2026-11-20 22:26 ` Roland Schober [this message]
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-5-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