fixed a logic error. param N is used as total number of blocks. I is using it as zero based index...

This commit is contained in:
iceman1001 2023-05-24 15:43:44 +02:00
commit 37e5540aab

View file

@ -304,7 +304,9 @@ static int mf_print_keys(uint16_t n, uint8_t *d) {
return PM3_EMALLOC; 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)) { if (mfIsSectorTrailer(i)) {
e_sector[mfSectorNum(i)].foundKey[0] = 1; e_sector[mfSectorNum(i)].foundKey[0] = 1;
e_sector[mfSectorNum(i)].Key[0] = bytes_to_num(d + (i * MFBLOCK_SIZE), MIFARE_KEY_SIZE); e_sector[mfSectorNum(i)].Key[0] = bytes_to_num(d + (i * MFBLOCK_SIZE), MIFARE_KEY_SIZE);