From ad64fdfeb7d5ab10128809b018f8d6ba8996c886 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Mon, 6 Jun 2022 19:07:16 +0200 Subject: [PATCH] adapt hf mfu eview to take prefix header lenght in consideration --- client/src/cmdhfmf.c | 4 +++- client/src/cmdhfmfu.c | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/client/src/cmdhfmf.c b/client/src/cmdhfmf.c index 90cb0b7c6..562e80fa8 100644 --- a/client/src/cmdhfmf.c +++ b/client/src/cmdhfmf.c @@ -3890,6 +3890,7 @@ int CmdHF14AMfELoad(const char *Cmd) { uint8_t block_width = 16; uint16_t block_cnt = MIFARE_1K_MAXBLOCK; + uint8_t hdr_len = 0; if (m0) { block_cnt = MIFARE_MINI_MAXBLOCK; @@ -3902,6 +3903,7 @@ int CmdHF14AMfELoad(const char *Cmd) { } else if (mu) { block_cnt = MFU_MAX_BLOCKS; block_width = MFU_BLOCK_SIZE; + hdr_len = MFU_DUMP_PREFIX_LENGTH; } else { PrintAndLogEx(WARNING, "Please specify a MIFARE Type"); return PM3_EINVARG; @@ -3916,7 +3918,7 @@ int CmdHF14AMfELoad(const char *Cmd) { uint8_t *data = NULL; size_t bytes_read = 0; - int res = pm3_load_dump(filename, (void **)&data, &bytes_read, (MFBLOCK_SIZE * MIFARE_4K_MAXBLOCK)); + int res = pm3_load_dump(filename, (void **)&data, &bytes_read, (block_width * block_cnt + hdr_len)); if (res != PM3_SUCCESS) { return res; } diff --git a/client/src/cmdhfmfu.c b/client/src/cmdhfmfu.c index 1f82db39b..e110554d6 100644 --- a/client/src/cmdhfmfu.c +++ b/client/src/cmdhfmfu.c @@ -4106,7 +4106,7 @@ static int CmdHF14AMfuEView(const char *Cmd) { CLIParserFree(ctx); uint16_t blocks = MFU_MAX_BLOCKS; - uint16_t bytes = MFU_MAX_BYTES; + uint16_t bytes = MFU_MAX_BYTES + MFU_DUMP_PREFIX_LENGTH; uint8_t *dump = calloc(bytes, sizeof(uint8_t)); if (dump == NULL) {