From 6dba732a6a78c86376a75c72e77a06bf1d9a3027 Mon Sep 17 00:00:00 2001 From: Marcus Meissner Date: Sat, 4 Jan 2020 17:58:01 +0100 Subject: initialize memory to avoid access of uninitialized memory (AFL) --- camlibs/spca50x/spca50x-flash.c | 2 +- camlibs/spca50x/spca50x-sdram.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'camlibs') 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) { -- cgit v1.2.1