libgphoto2 is a camera access and control library. In versions up to and including 2.5.33, a missing null terminator exists in ptpunpackCanon_FE() in camlibs/ptp2/ptp-pack.c (line 1377). The function copies a filename into a 13-byte buffer using strncpy without explicitly null-terminating the result. If the source data is exactly 13 bytes with no null terminator, the buffer is left unterminated, leading to out-of-bounds reads in any subsequent string operation. Commit 259fc7d3bfe534ce4b114c464f55b448670ab873 patches the issue.
{
"cwe_ids": [
"CWE-170"
],
"osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/40xxx/CVE-2026-40334.json",
"cna_assigner": "GitHub_M"
}"2026-07-22T00:24:30Z"
[
{
"signature_type": "Function",
"target": {
"file": "camlibs/ptp2/ptp-pack.c",
"function": "ptp_unpack_Canon_FE"
},
"deprecated": false,
"source": "https://github.com/gphoto/libgphoto2/commit/259fc7d3bfe534ce4b114c464f55b448670ab873",
"id": "CVE-2026-40334-653b1fce",
"signature_version": "v1",
"digest": {
"function_hash": "332789816117250806772017235864637529635",
"length": 553.0
}
},
{
"signature_type": "Line",
"target": {
"file": "camlibs/ptp2/ptp-pack.c"
},
"deprecated": false,
"source": "https://github.com/gphoto/libgphoto2/commit/259fc7d3bfe534ce4b114c464f55b448670ab873",
"id": "CVE-2026-40334-e2c1dc06",
"signature_version": "v1",
"digest": {
"line_hashes": [
"264833626875413133082486546480536312426",
"66162376617624956083055343090675811804",
"216127511021842429427332640001788391942",
"191076344472402919272878336536017125386"
],
"threshold": 0.9
}
}
]
"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-40334.json"