From 37e5540aab52d7b57ed206b65ca71d06435e4bae Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Wed, 24 May 2023 15:43:44 +0200 Subject: [PATCH] fixed a logic error. param N is used as total number of blocks. I is using it as zero based index... --- client/src/cmdhfmf.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client/src/cmdhfmf.c b/client/src/cmdhfmf.c index 8d862b78d..ffc607617 100644 --- a/client/src/cmdhfmf.c +++ b/client/src/cmdhfmf.c @@ -304,7 +304,9 @@ static int mf_print_keys(uint16_t n, uint8_t *d) { return PM3_EMALLOC; } - for (uint16_t i = 0; i < n; i++) { + // n is number of blocks, but in the loop its a zero based index. + // n = 20, i = 0-19 + for (uint16_t i = 0; i < n - 1; i++) { if (mfIsSectorTrailer(i)) { e_sector[mfSectorNum(i)].foundKey[0] = 1; e_sector[mfSectorNum(i)].Key[0] = bytes_to_num(d + (i * MFBLOCK_SIZE), MIFARE_KEY_SIZE);