do not return names in info_func if longer than the actual buffersize.
git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@8512 67ed7778-7388-44ab-90cf-0a291f65f57c
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
* library.c: Added HP Photosmart E317
|
||||
* library.c: Relaxed Association checks for directories.
|
||||
The E317 sees AssocType 0x0 (undefined) for DCIM/ et.al.
|
||||
|
||||
Avoid buffer overflows on too long filenames.
|
||||
|
||||
2006-01-17 Marcus Meissner <marcus@jet.franken.de>
|
||||
|
||||
|
||||
@@ -3644,7 +3644,11 @@ get_info_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
oi=&camera->pl->params.objectinfo[object_id];
|
||||
|
||||
info->file.fields = GP_FILE_INFO_SIZE|GP_FILE_INFO_TYPE|GP_FILE_INFO_MTIME;
|
||||
if (oi->Filename) {
|
||||
|
||||
/* Avoid buffer overflows on long filenames, just don't copy it
|
||||
* if it is too long.
|
||||
*/
|
||||
if (oi->Filename && (strlen(oi->Filename)+1 < sizeof(info->file.name))) {
|
||||
strcpy(info->file.name, oi->Filename);
|
||||
info->file.fields |= GP_FILE_INFO_NAME;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user