Improper Null Termination Affecting libgphoto2 package, versions <2.5.33-1ubuntu1.1


Severity

Recommended
medium

Based on Ubuntu security rating.

Threat Intelligence

EPSS
0.19% (10th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk IDSNYK-UBUNTU2604-LIBGPHOTO2-16239551
  • published23 Jul 2026
  • disclosed18 Apr 2026

Introduced: 18 Apr 2026

CVE-2026-40334  (opens in a new tab)
CWE-170  (opens in a new tab)

How to fix?

Upgrade Ubuntu:26.04 libgphoto2 to version 2.5.33-1ubuntu1.1 or higher.

NVD Description

Note: Versions mentioned in the description apply only to the upstream libgphoto2 package and not the libgphoto2 package as distributed by Ubuntu. See How to fix? for Ubuntu:26.04 relevant fixed versions and status.

libgphoto2 is a camera access and control library. In versions up to and including 2.5.33, a missing null terminator exists in ptp_unpack_Canon_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.

CVSS Base Scores

version 3.1