Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH BlueZ 0/5] monitor: Fix reads beyond advertising data
@ 2026-11-20 22:26 Roland Schober
  2026-11-20 22:26 ` [PATCH BlueZ 1/5] monitor: Fix overflow of the name buffer in print_eir Roland Schober
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Roland Schober @ 2026-11-20 22:26 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Roland Schober

print_eir() and the decoders it calls take advertising data, which a
remote device chooses. This series fixes five places where btmon reads
or writes beyond that data, or decodes it from the wrong place:

 - a Shortened Local Name, Complete Local Name or Broadcast Name of
   240 or more octets is copied beyond a buffer of 239 octets,
 - the Flags and the Security Manager OOB Flags are read from an AD
   structure which has no data,
 - an Unprovisioned Device Beacon of 18 octets is decoded although its
   OOB Information lacks an octet,
 - the Apple identifier is printed as a string which nothing
   terminates,
 - a Public Broadcast Announcement is reported as invalid when it is
   well formed, and decoded from uninitialised variables when it is
   too short.

Copilot found the first one in its review of "monitor: Decode Periodic
Advertising with Responses" v4, whose new decoders hand advertising
data to print_eir() as well. The bug is older than that series and
can be reached without it, e.g. by an LE Periodic Advertising Report,
so the fixes come as a series of their own. A v5 of the decoding
series will follow on top of it.

The others were found by feeding print_eir() one AD structure of every
type with every length up to 250 octets, in a buffer of exactly that
size with AddressSanitizer, and by review. The same test passes with
the series applied. The reads of patches 1 to 4 show there as
AddressSanitizer reports; patch 5 was tested with hand-made btsnoop
traces only.

Roland Schober (5):
  monitor: Fix overflow of the name buffer in print_eir
  monitor: Fix reading Flags beyond empty AD structures
  monitor: Fix reading beyond a short Mesh Beacon
  monitor: Fix reading beyond the Apple manufacturer data
  monitor: Fix decoding of Public Broadcast Announcements

 monitor/packet.c | 29 ++++++++++++++++++-----------
 1 file changed, 18 insertions(+), 11 deletions(-)

-- 
2.47.3


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-11-20 22:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox