From 90d1fed1fab42594d285f7d4d488eb56f3505bb3 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Mon, 24 Jul 2023 15:14:17 +0200 Subject: [PATCH] coverity somehow believes we read a long string from a file and the data isnt null terminated (i.e. last char is 0x00) so let see if a ugly + 1 will do the trick --- client/src/flash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/flash.c b/client/src/flash.c index 4629dbdcd..b1f4a28c9 100644 --- a/client/src/flash.c +++ b/client/src/flash.c @@ -286,7 +286,7 @@ int flash_load(flash_file_t *ctx, bool force) { goto fail; } - ctx->elf = calloc(fsize, sizeof(uint8_t)); + ctx->elf = calloc(fsize + 1, sizeof(uint8_t)); if (!ctx->elf) { PrintAndLogEx(ERR, "Error, cannot allocate memory"); res = PM3_EMALLOC;