Fixed UINT128/INT128 Unchecked Offset Advance (CWE-125) — MEDIUM

Finding 5: UINT128/INT128 Unchecked Offset Advance (CWE-125) — MEDIUM

In ptp_unpack_DPV(), the PTP_DTC_UINT128 and PTP_DTC_INT128 cases advance *offset += 16 without verifying 16 bytes remain. The entry check at line 609 only guarantees *offset < total (at least 1 byte available). After the unchecked advance, *offset can exceed total, and the CTVAL macro's bounds check (total - *offset < sizeof(target)) wraps due to unsigned arithmetic.

CVE-2026-40335

Reported-By: Sebastián Alba <sebasjosue84@gmail.com>
This commit is contained in:
Marcus Meissner
2026-04-08 15:07:38 +02:00
parent 259fc7d3bf
commit 433bde9888

View File

@@ -620,10 +620,14 @@ ptp_unpack_DPV (
case PTP_DTC_UINT64: CTVAL(value->u64,dtoh64a); break;
case PTP_DTC_UINT128:
if (total - *offset < 16)
return 0;
*offset += 16;
/*fprintf(stderr,"unhandled unpack of uint128n");*/
break;
case PTP_DTC_INT128:
if (total - *offset < 16)
return 0;
*offset += 16;
/*fprintf(stderr,"unhandled unpack of int128n");*/
break;