summaryrefslogtreecommitdiffstats
path: root/src/webinspector.h
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2026-11-17 04:20:00 +0100
committerGravatar Nikias Bassen2026-11-17 04:20:00 +0100
commit64a031522dd7565c7e9a4506b3e732f602972634 (patch)
tree2f095f26de1a14ce8c05044ea5beb3479fed84fd /src/webinspector.h
parentfa0f79190142bc309307967c058f89c1b36eb6b8 (diff)
downloadlibimobiledevice-64a031522dd7565c7e9a4506b3e732f602972634.tar.gz
libimobiledevice-64a031522dd7565c7e9a4506b3e732f602972634.tar.bz2
afc: validate entire_length/this_length in afc_receive_dataHEADmaster
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 'src/webinspector.h')
0 files changed, 0 insertions, 0 deletions