avoid unbounded strcpy ingto fixed size buffer

fixes https://github.com/gphoto/libgphoto2/issues/1223
This commit is contained in:
Marcus Meissner
2026-03-17 10:11:59 +01:00
parent 71c0ff6545
commit 389683bb34

View File

@@ -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 */