diff options
| author | 2026-11-17 04:20:00 +0100 | |
|---|---|---|
| committer | 2026-11-17 04:20:00 +0100 | |
| commit | 64a031522dd7565c7e9a4506b3e732f602972634 (patch) | |
| tree | 2f095f26de1a14ce8c05044ea5beb3479fed84fd /include/libimobiledevice | |
| parent | fa0f79190142bc309307967c058f89c1b36eb6b8 (diff) | |
| download | libimobiledevice-64a031522dd7565c7e9a4506b3e732f602972634.tar.gz libimobiledevice-64a031522dd7565c7e9a4506b3e732f602972634.tar.bz2 | |
The AFC packet header fields entire_length and this_length were only
checked to ensure this_length >= sizeof(AFCPacket). Neither field was
validated against the other, allowing a malicious or compromised
device to trigger:
- A heap buffer overflow (CWE-787): if this_length > entire_length,
buf is malloc'd with the smaller entire_len but service_receive()
writes this_len attacker-controlled bytes into it.
- An integer underflow leading to a crash (CWE-191): if
entire_length < sizeof(AFCPacket), entire_len underflows to a huge
value, malloc() fails, and the returned NULL buf is later
dereferenced.
Add explicit checks that entire_length is at least sizeof(AFCPacket)
and fits in 32 bits, and that this_length never exceeds entire_length,
rejecting malformed packets with AFC_E_OP_HEADER_INVALID. Also handle
malloc() failure by returning AFC_E_NO_MEM instead of proceeding with
a NULL buffer.
Reported September 1st, 2026
Reported-by: Karnakar Reddy <karnakarthoorpu@gmail.com>
Diffstat (limited to 'include/libimobiledevice')
0 files changed, 0 insertions, 0 deletions
