handle partial read files, avoid crashes (AFL)
This commit is contained in:
@@ -330,7 +330,10 @@ file_list_func (CameraFilesystem *fs, const char *folder,
|
||||
CHECK (spca50x_sdram_get_info (camera->pl));
|
||||
|
||||
for (i = 0; i < camera->pl->num_files_on_sdram; i++) {
|
||||
strncpy (temp_file, camera->pl->files[i].name, 12);
|
||||
if (camera->pl->files[i].name)
|
||||
strncpy (temp_file, camera->pl->files[i].name, 12);
|
||||
else
|
||||
strcpy (temp_file, "BAD.BAD");
|
||||
temp_file[12] = 0;
|
||||
gp_list_append (list, temp_file, NULL);
|
||||
}
|
||||
|
||||
@@ -226,6 +226,7 @@ spca50x_get_image (CameraPrivateLibrary * lib, uint8_t ** buf,
|
||||
int omit_escape = 0;
|
||||
|
||||
p = g_file->fat;
|
||||
if (!p) return GP_ERROR;
|
||||
|
||||
/* get the position in memory where the image is */
|
||||
start = (p[1] & 0xff) + (p[2] & 0xff) * 0x100;
|
||||
|
||||
Reference in New Issue
Block a user