# CVE-2026-40338

> Vulnerability · severity: **MEDIUM** (CVSS 5.2).

## Description

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.

## Key facts

- **CVE ID:** CVE-2026-40338
- **Published:** 2026-04-18
- **CVSS severity:** MEDIUM
- **CVSS base score:** 5.2
- **CWE codes:** CWE-125

## Primary sources

- NIST NVD: https://nvd.nist.gov/vuln/detail/CVE-2026-40338

## Citation

> AI Analytics. CVE-2026-40338. Retrieved 2026-07-19 from https://api.ai-analytics.org/cve/CVE-2026-40338. Derived from NIST NVD. Licensed CC0.

---

*[Dataset catalog](https://api.ai-analytics.org/datasets/) · [AI Analytics](https://api.ai-analytics.org/) · CC0 1.0*