From 389683bb34f46b29d7cc01eb45b57095dfd758c6 Mon Sep 17 00:00:00 2001 From: Marcus Meissner Date: Tue, 17 Mar 2026 10:11:59 +0100 Subject: [PATCH] avoid unbounded strcpy ingto fixed size buffer fixes https://github.com/gphoto/libgphoto2/issues/1223 --- camlibs/ptp2/library.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/camlibs/ptp2/library.c b/camlibs/ptp2/library.c index e1120a1d8..a8974e368 100644 --- a/camlibs/ptp2/library.c +++ b/camlibs/ptp2/library.c @@ -3403,7 +3403,7 @@ find_object_path (Camera *camera, PTPObject **ob, CameraFilePath *path) GP_LOG_D ("(storage=0x%08x, handle=0x%08x)", (*ob)->oi.StorageID, (*ob)->oi.Handle); uint32_t handle = (*ob)->oi.Handle; - strcpy (path->name, (*ob)->oi.Filename); + strncpy (path->name, (*ob)->oi.Filename, sizeof(path->name)); sprintf (path->folder,"/"STORAGE_FOLDER_PREFIX"%08lx",(unsigned long)(*ob)->oi.StorageID); CR (append_folder_from_handle (camera, (*ob)->oi.StorageID, (*ob)->oi.ParentObject, path->folder)); /* re-fetch invalidated ob cache pointer */