From: Roland Schober <rolandschober1968@gmail.com>
To: linux-bluetooth@vger.kernel.org
Cc: Roland Schober <rolandschober1968@gmail.com>
Subject: [PATCH BlueZ 1/5] monitor: Fix overflow of the name buffer in print_eir
Date: Fri, 20 Nov 2026 23:26:20 +0100 [thread overview]
Message-ID: <20261120222624.150321-2-rolandschober1968@gmail.com> (raw)
In-Reply-To: <20261120222624.150321-1-rolandschober1968@gmail.com>
print_eir() copies the Shortened Local Name, the Complete Local Name
and the Broadcast Name into a buffer of 239 octets, which is enough for
the 240 octets of an Extended Inquiry Response. Advertising data from
other packets can have longer AD structures: an LE Periodic Advertising
Report with a Complete Local Name of 240 octets makes AddressSanitizer
report a write beyond the buffer.
Size the buffer for the largest AD structure.
Fixes: 854c945433fc ("monitor: Add full EIR parsing support")
Fixes: 99deeea86f15 ("btmon: Decode Broadcast Name")
Assisted-by: Claude:claude-fable-5-2
---
monitor/packet.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/monitor/packet.c b/monitor/packet.c
index eddf8706a..bce3bb819 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -4418,7 +4418,7 @@ static void print_eir(const char *label, const uint8_t *eir, uint8_t eir_len,
uint8_t field_len = eir[0];
const uint8_t *data = &eir[2];
uint8_t data_len;
- char name[239], label[100];
+ char name[255], label[100];
uint8_t flags, mask;
/* Check for the end of EIR */
--
2.47.3
next prev parent reply other threads:[~2026-11-20 22:26 UTC|newest]
Thread overview: 7+ 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 ` Roland Schober [this message]
2026-11-21 3:58 ` bluez.test.bot
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 ` [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-2-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.