diff --git a/meta-oe/recipes-graphics/gphoto2/libgphoto2/CVE-2026-40334.patch b/meta-oe/recipes-graphics/gphoto2/libgphoto2/CVE-2026-40334.patch new file mode 100644 index 0000000000..883582dff0 --- /dev/null +++ b/meta-oe/recipes-graphics/gphoto2/libgphoto2/CVE-2026-40334.patch @@ -0,0 +1,37 @@ +From 20b33a26b2efdbf2c35c5cacc54a041855ec764b Mon Sep 17 00:00:00 2001 +From: Marcus Meissner +Date: Wed, 8 Apr 2026 15:15:54 +0200 +Subject: [PATCH] Fixed Canon FolderEntry Missing Null Termination +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +ptp_unpack_Canon_FE() copies filename with strncpy into a 13-byte +buffer without explicit null termination. The EOS variant at line +1451–1452 correctly adds fe->Filename[PTP_CANON_FilenameBufferLen-1] += 0; confirming this was recognized as necessary but not applied to the +original Canon path. + + CVE-2026-40334 + +Reported-By: Sebastián Alba + +CVE: CVE-2026-40334 +Upstream-Status: Backport [https://github.com/gphoto/libgphoto2/commit/259fc7d3bfe534ce4b114c464f55b448670ab873] +Signed-off-by: Gyorgy Sarvari +--- + camlibs/ptp2/ptp-pack.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/camlibs/ptp2/ptp-pack.c b/camlibs/ptp2/ptp-pack.c +index 09dcc24..982b4f4 100644 +--- a/camlibs/ptp2/ptp-pack.c ++++ b/camlibs/ptp2/ptp-pack.c +@@ -1369,6 +1369,7 @@ ptp_unpack_Canon_FE (PTPParams *params, const unsigned char* data, PTPCANONFolde + fe->ObjectSize = dtoh32a(data + PTP_cfe_ObjectSize); + fe->Time = (time_t)dtoh32a(data + PTP_cfe_Time); + strncpy(fe->Filename, (char*)data + PTP_cfe_Filename, PTP_CANON_FilenameBufferLen); ++ fe->Filename[PTP_CANON_FilenameBufferLen-1] = '\0'; + } + + /* diff --git a/meta-oe/recipes-graphics/gphoto2/libgphoto2_2.5.33.bb b/meta-oe/recipes-graphics/gphoto2/libgphoto2_2.5.33.bb index ac7892151f..e8e56171a1 100644 --- a/meta-oe/recipes-graphics/gphoto2/libgphoto2_2.5.33.bb +++ b/meta-oe/recipes-graphics/gphoto2/libgphoto2_2.5.33.bb @@ -14,6 +14,7 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/gphoto/${BP}.tar.xz;name=libgphoto2 \ file://0001-configure-Filter-out-buildpaths-from-CC.patch \ file://0001-libgphoto2-fix-const-correctness-for-c23-builds.patch \ file://CVE-2026-40333.patch \ + file://CVE-2026-40334.patch \ " SRC_URI[libgphoto2.sha256sum] = "28825f767a85544cb58f6e15028f8e53a5bb37a62148b3f1708b524781c3bef2"