Linux bluetooth development
 help / color / mirror / Atom feed
From: Roland Schober <rolandschober1968@gmail.com>
To: linux-bluetooth@vger.kernel.org
Cc: Roland Schober <rolandschober1968@gmail.com>
Subject: [PATCH BlueZ 0/5] monitor: Fix reads beyond advertising data
Date: Fri, 20 Nov 2026 23:26:19 +0100	[thread overview]
Message-ID: <20261120222624.150321-1-rolandschober1968@gmail.com> (raw)

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


             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 Roland Schober [this message]
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

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-1-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