summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Meissner <marcus@jet.franken.de>2020-01-04 17:58:01 +0100
committerMarcus Meissner <marcus@jet.franken.de>2020-01-04 17:58:01 +0100
commit6dba732a6a78c86376a75c72e77a06bf1d9a3027 (patch)
treecc04c919a9929561a4e1da07aa7de4e5eb41a04f
parentb0f595104932cf594fbf1f4675d138299abcc4fe (diff)
downloadlibgphoto2-6dba732a6a78c86376a75c72e77a06bf1d9a3027.tar.gz
initialize memory to avoid access of uninitialized memory (AFL)
-rw-r--r--camlibs/spca50x/spca50x-flash.c2
-rw-r--r--camlibs/spca50x/spca50x-sdram.c4
2 files changed, 3 insertions, 3 deletions
diff --git a/camlibs/spca50x/spca50x-flash.c b/camlibs/spca50x/spca50x-flash.c
index fecf80a3c..efb73efd8 100644
--- a/camlibs/spca50x/spca50x-flash.c
+++ b/camlibs/spca50x/spca50x-flash.c
@@ -196,7 +196,7 @@ spca50x_flash_get_TOC(CameraPrivateLibrary *pl, int *filecount)
/* Now, create the files info buffer */
free_files(pl);
/* NOTE: using calloc to ensure new block is "empty" */
- pl->files = calloc (1, *filecount * sizeof (struct SPCA50xFile));
+ pl->files = calloc (*filecount , sizeof (struct SPCA50xFile));
if (!pl->files)
return GP_ERROR_NO_MEMORY;
} else { /* all other cams with flash... */
diff --git a/camlibs/spca50x/spca50x-sdram.c b/camlibs/spca50x/spca50x-sdram.c
index d445947aa..8ac57e26f 100644
--- a/camlibs/spca50x/spca50x-sdram.c
+++ b/camlibs/spca50x/spca50x-sdram.c
@@ -872,8 +872,8 @@ spca50x_get_FATs (CameraPrivateLibrary * lib, int dramtype)
lib->files = NULL;
}
- lib->fats = malloc (lib->num_fats * SPCA50X_FAT_PAGE_SIZE);
- lib->files = malloc (lib->num_files_on_sdram * sizeof (struct SPCA50xFile));
+ lib->fats = calloc (lib->num_fats , SPCA50X_FAT_PAGE_SIZE);
+ lib->files = calloc (lib->num_files_on_sdram , sizeof (struct SPCA50xFile));
p = lib->fats;
if (lib->bridge == BRIDGE_SPCA504) {