This is an automated email from Gerrit.

Mischa Studer ([email protected]) just uploaded a new patch set to Gerrit, 
which you can find at http://openocd.zylin.com/6070

-- gerrit

commit 2ad6032f294bd603ac31a886a291f0456f5e9635
Author: Mischa Studer <[email protected]>
Date:   Wed Feb 24 13:24:51 2021 +0100

    SegmentationFault: False write-mem pointer to nowhere
    
    Commit dunno
    In flash/nor/cfi.c:835 initialised cfi_info cleared (calloc). As write-mem
    was uninitialized the pointer pointed to an out of range address, which
    led to a segmentation fault and crashed openocd. This happened during 
flash-command
    of an external flash-bank, using cfi.
    
    Change-Id: I0e2ffb90559afe7f090837023428dcc06b2e29f6
    Signed-off-by: Mischa Studer <[email protected]>

diff --git a/src/flash/nor/cfi.c b/src/flash/nor/cfi.c
index 5f5071e..9cf3212 100644
--- a/src/flash/nor/cfi.c
+++ b/src/flash/nor/cfi.c
@@ -832,7 +832,7 @@ int cfi_flash_bank_cmd(struct flash_bank *bank, unsigned 
int argc, const char **
                return ERROR_FLASH_BANK_INVALID;
        }
 
-       cfi_info = malloc(sizeof(struct cfi_flash_bank));
+       cfi_info = calloc(sizeof(struct cfi_flash_bank));
        cfi_info->probed = false;
        cfi_info->erase_region_info = NULL;
        cfi_info->pri_ext = NULL;

-- 


_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to