From: Bastien Nocera <hadess@hadess.net>
To: linux-bluetooth@vger.kernel.org
Cc: Elman Shahbazov <shahbazovelman97@gmail.com>
Subject: [BlueZ 3/3] avrcp: Fix Out-of-Bounds Read in AVRCP GetFolderItems parsing
Date: Tue, 4 Aug 2026 14:44:50 +0200 [thread overview]
Message-ID: <20260804124511.2212066-3-hadess@hadess.net> (raw)
In-Reply-To: <20260804124511.2212066-1-hadess@hadess.net>
From: Elman Shahbazov <shahbazovelman97@gmail.com>
Co-Authored-by: Bastien Nocera <hadess@hadess.net>
---
profiles/audio/avrcp-parse.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/profiles/audio/avrcp-parse.c b/profiles/audio/avrcp-parse.c
index d3d0a070a4da..251580fd9c55 100644
--- a/profiles/audio/avrcp-parse.c
+++ b/profiles/audio/avrcp-parse.c
@@ -20,8 +20,12 @@ gboolean parse_media_element_name(uint8_t *operands, uint16_t len,
return FALSE;
memset(name, 0, NAME_MAX_LEN);
- *namesize = get_be16(&operands[11]);
+ *namesize = MIN(get_be16(&operands[11]), len - 13);
namelen = MIN(*namesize, NAME_MAX_LEN - 1);
+
+ if (len < 13 + *namesize)
+ return FALSE;
+
if (namelen > 0) {
memcpy(name, &operands[13], namelen);
strtoutf8(name, namelen);
@@ -39,7 +43,8 @@ gboolean parse_media_folder_name(uint8_t *operands, uint16_t len,
return FALSE;
memset(name, 0, NAME_MAX_LEN);
- namelen = MIN(get_be16(&operands[12]), NAME_MAX_LEN - 1);
+ namelen = MIN(get_be16(&operands[12]), len - 14);
+ namelen = MIN(namelen, NAME_MAX_LEN - 1);
if (namelen > 0)
memcpy(name, &operands[14], namelen);
--
2.55.0
next prev parent reply other threads:[~2026-08-04 12:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-04 12:44 [BlueZ 1/3] avrcp: Split off name parsing from parse_*_element() Bastien Nocera
2026-08-04 12:44 ` [BlueZ 2/3] unit: Adapt poc_*_oob.c test into a new test Bastien Nocera
2026-08-04 12:44 ` Bastien Nocera [this message]
2026-08-04 13:49 ` [BlueZ,1/3] avrcp: Split off name parsing from parse_*_element() bluez.test.bot
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=20260804124511.2212066-3-hadess@hadess.net \
--to=hadess@hadess.net \
--cc=linux-bluetooth@vger.kernel.org \
--cc=shahbazovelman97@gmail.com \
/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