From 54153153b8e7e63eb02334cdd1b0cf4af43717f8 Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Tue, 25 May 2021 20:00:04 +0200 Subject: [PATCH] Fix issue #1287 --- client/src/cmdhfmf.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/client/src/cmdhfmf.c b/client/src/cmdhfmf.c index 0f232f4db..121e64426 100644 --- a/client/src/cmdhfmf.c +++ b/client/src/cmdhfmf.c @@ -1972,8 +1972,9 @@ static int CmdHF14AMfAutoPWN(const char *Cmd) { // ------------------------------ // create/initialize key storage structure - res = initSectorTable(&e_sector, sector_cnt); - if (res != sector_cnt) { + uint32_t e_sector_size = sector_cnt > sectorno ? sector_cnt : sectorno + 1; + res = initSectorTable(&e_sector, e_sector_size); + if (res != e_sector_size) { free(e_sector); return PM3_EMALLOC; }