{"id":"CVE-2026-40339","aliases":["CVE-2026-40339"],"related":[],"kind":"vulnerability","state":"published","title":"libgphoto2 has OOB read in ptp_unpack_Sony_DPD() FormFlag parsing in ptp-pack.c","summary":"libgphoto2 is a camera access and control library. Versions up to and including 2.5.33 have an out-of-bounds read in `ptp_unpack_Sony_DPD()` in `camlibs/ptp2/ptp-pack.c` (line 842). The function reads the FormFlag byte via `dtoh8o(data, *poffset)` without a prior bounds check. The standard `ptp_unpack_DPD()` at lines 686–687 correctly validates `*offset + sizeof(uint8_t) > dpdlen` before this same read, but the Sony variant omits this check entirely. Commit 09f8a940b1e418b5693f5c11e3016a1ad2cea62d fixes the issue.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"libgphoto2 is a camera access and control library. Versions up to and including 2.5.33 have an out-of-bounds read in `ptp_unpack_Sony_DPD()` in `camlibs/ptp2/ptp-pack.c` (line 842). The function reads the FormFlag byte via `dtoh8o(data, *poffset)` without a prior bounds check. The standard `ptp_unpack_DPD()` at lines 686–687 correctly validates `*offset + sizeof(uint8_t) > dpdlen` before this same read, but the Sony variant omits this check entirely. Commit 09f8a940b1e418b5693f5c11e3016a1ad2cea62d fixes the issue.","source":"cvelist"},{"lang":"es","text":"libgphoto2 es una biblioteca de acceso y control de cámaras. Las versiones hasta la 2.5.33 inclusive tienen una lectura fuera de límites en “ptp_unpack_Sony_DPD()” en “camlibs/ptp2/ptp-pack.c” (línea 842). La función lee el byte FormFlag a través de “dtoh8o(data, poffset)” sin una comprobación de límites previa. La función estándar “ptp_unpack_DPD()” en las líneas 686-687 valida correctamente “offset + sizeof(uint8_t) > dpdlen” antes de esta misma lectura, pero la variante de Sony omite esta comprobación por completo. El commit 09f8a940b1e418b5693f5c11e3016a1ad2cea62d corrige el problema.","source":"nvd"}],"published":"2026-04-17T23:42:32.586Z","modified":"2026-10-25T23:10:00.167Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:P/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:L","score":5.2,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:P/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:L","score":5.2,"rating":"MEDIUM"}],"cwes":["CWE-125"],"affected":[{"ranges":[{"version":"<= 2.5.33","status":"affected"}],"vendor":"gphoto","product":"libgphoto2","source":"cvelist"}],"references":[{"url":"https://github.com/gphoto/libgphoto2/security/advisories/GHSA-42cm-m9hc-r7q8","tags":["x-refsource-confirm"],"sources":["cvelist","nvd"]},{"url":"https://github.com/gphoto/libgphoto2/commit/09f8a940b1e418b5693f5c11e3016a1ad2cea62d","tags":["x-refsource-misc"],"sources":["cvelist","nvd"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"partial","date":"2026-04-20T14:51:42.764Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-40339","url":"https://www.cve.org/CVERecord?id=CVE-2026-40339","licence":"CVE Terms of Use","modified":"2026-04-20T14:56:21.979Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-40339","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-40339","licence":"Public domain","modified":"2026-10-25T23:10:00.167Z"}],"updatedAt":"2026-11-25T22:59:18.982Z","epss":{"score":0.00205,"percentile":0.1112,"date":"2026-12-01T12:00:22.000Z"}}