libgphoto2 is a camera access and control library. Versions up to and including 2.5.33 have an out-of-bounds read in the PTP_DPFF_Enumeration case of ptp_unpack_Sony_DPD() in camlibs/ptp2/ptp-pack.c (line 856). The function reads a 2-byte enumeration count N via dtoh16o(data, *poffset) without verifying that 2 bytes remain in the buffer. The standard ptp_unpack_DPD() at line 704 has this exact check, confirming the Sony variant omitted it by oversight. Commit 3b9f9696be76ae51dca983d9dd8ce586a2561845 fixes the issue.
{
"cna_assigner": "GitHub_M",
"cwe_ids": [
"CWE-125"
],
"osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/40xxx/CVE-2026-40338.json"
}"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-40338.json"
[
{
"deprecated": false,
"digest": {
"function_hash": "21965023955985201892548801764292135121",
"length": 4187
},
"id": "CVE-2026-40338-595dd851",
"signature_type": "Function",
"signature_version": "v1",
"source": "https://github.com/gphoto/libgphoto2/commit/3b9f9696be76ae51dca983d9dd8ce586a2561845",
"target": {
"file": "camlibs/ptp2/ptp-pack.c",
"function": "ptp_unpack_Sony_DPD"
}
},
{
"deprecated": false,
"digest": {
"line_hashes": [
"236872050466299106511125346444051247505",
"176932953261585094079536782933750801386",
"126427036254075555145455405924006108582"
],
"threshold": 0.9
},
"id": "CVE-2026-40338-fa21efd2",
"signature_type": "Line",
"signature_version": "v1",
"source": "https://github.com/gphoto/libgphoto2/commit/3b9f9696be76ae51dca983d9dd8ce586a2561845",
"target": {
"file": "camlibs/ptp2/ptp-pack.c"
}
}
]
"2026-08-12T16:25:08Z"