Bug 2525293

Summary: avrcp: out-of-bounds read of the attribute count in parse_media_element() still possible after bd8989620ed6 (truncated GetFolderItems media element)
Product: [Fedora] Fedora Reporter: Alejandro <alejandroperezpestana99>
Component: bluezAssignee: Peter Robinson <pbrobinson>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: rawhideCC: bnocera, dwmw2, lihis, michel, ngompa13, pbrobinson
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: bluez-5.87+1.git8750129efca8-1.fc44 bluez-5.87+1.git8750129efca8-1.fc45 bluez-5.87+1.git8750129efca8-1.fc43 Doc Type: ---
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2026-09-11 01:01:56 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Alejandro 2026-08-27 22:45:59 UTC
Rebasing 5.87, I think bd8989620ed6 missed one read in parse_media_element()
(profiles/audio/avrcp.c):

```c
if (!parse_media_name(operands, len, 11, name, &namesize))
        return NULL;
uid = get_be64(&operands[0]);
count = operands[13 + namesize];
```

parse_media_name() only checks len >= name_len_offset + 2 + namesize, so all we
know is len >= 13 + namesize. At len == 13 + namesize, operands[13 + namesize] is
operands[len], one byte past the element, and both len and the declared name
length come from the peer on the browsing channel.

avrcp_list_items_rsp() allows i + len == operand_count, so the read lands at
buf[ret] in the g_malloc0(MAX(imtu, omtu)) buffer from avctp.c. Usually that's a
leftover byte still inside the allocation,t's only
past the buffer when the response fills the MTU and imtu >= omtu.

Reproducible: Always

Steps to Reproduce:
Found by reading the code, not from a crash.



Additional Information:
Affects 5.87 and any 5.86 carrying bd8989620ed6. Guard I had in mind:

```c
if (len <= 13 + namesize)
        return NULL;
```

Comment 1 Bastien Nocera 2026-09-01 11:47:26 UTC
Before I post it upstream, do you want to comment on:
https://gist.github.com/hadess/88da1bdb4c8e6930d052c8f150b10701
?

I can also put in a longer name credit.

Comment 2 Fedora Update System 2026-09-09 13:04:51 UTC
FEDORA-2026-9e011ac6ed (bluez-5.87+1.git8750129efca8-1.fc45) has been submitted as an update to Fedora 45.
https://bodhi.fedoraproject.org/updates/FEDORA-2026-9e011ac6ed

Comment 3 Fedora Update System 2026-09-09 13:05:49 UTC
FEDORA-2026-d4156b5fc5 (bluez-5.87+1.git8750129efca8-1.fc44) has been submitted as an update to Fedora 44.
https://bodhi.fedoraproject.org/updates/FEDORA-2026-d4156b5fc5

Comment 4 Fedora Update System 2026-09-09 13:06:39 UTC
FEDORA-2026-6ed52ea50e (bluez-5.87+1.git8750129efca8-1.fc43) has been submitted as an update to Fedora 43.
https://bodhi.fedoraproject.org/updates/FEDORA-2026-6ed52ea50e

Comment 5 Fedora Update System 2026-09-10 01:47:13 UTC
FEDORA-2026-d4156b5fc5 has been pushed to the Fedora 44 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2026-d4156b5fc5`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2026-d4156b5fc5

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 6 Fedora Update System 2026-09-10 02:07:31 UTC
FEDORA-2026-6ed52ea50e has been pushed to the Fedora 43 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2026-6ed52ea50e`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2026-6ed52ea50e

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 7 Fedora Update System 2026-09-10 02:17:35 UTC
FEDORA-2026-9e011ac6ed has been pushed to the Fedora 45 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2026-9e011ac6ed`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2026-9e011ac6ed

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 8 Fedora Update System 2026-09-11 01:01:56 UTC
FEDORA-2026-d4156b5fc5 (bluez-5.87+1.git8750129efca8-1.fc44) has been pushed to the Fedora 44 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 9 Fedora Update System 2026-09-12 00:19:05 UTC
FEDORA-2026-9e011ac6ed (bluez-5.87+1.git8750129efca8-1.fc45) has been pushed to the Fedora 45 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 10 Fedora Update System 2026-09-12 01:15:15 UTC
FEDORA-2026-6ed52ea50e (bluez-5.87+1.git8750129efca8-1.fc43) has been pushed to the Fedora 43 stable repository.
If problem still persists, please make note of it in this bug report.