mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-02-26 00:55:19 +08:00
coverity believes somehow the return value from mfSectorNum can be 31. And wants us to check that it is only same size as sectors allocated
This commit is contained in:
parent
72057f9b81
commit
fcde2978a8
1 changed files with 7 additions and 6 deletions
|
@ -376,13 +376,14 @@ static int mf_print_keys(uint16_t n, uint8_t *d) {
|
|||
}
|
||||
|
||||
for (uint16_t i = 0; i < n; i++) {
|
||||
if (mfIsSectorTrailer(i)) {
|
||||
uint8_t sec = mfSectorNum(i);
|
||||
e_sector[sec].foundKey[0] = 1;
|
||||
e_sector[sec].Key[0] = bytes_to_num(d + (i * MFBLOCK_SIZE), MIFARE_KEY_SIZE);
|
||||
e_sector[sec].foundKey[1] = 1;
|
||||
e_sector[sec].Key[1] = bytes_to_num(d + (i * MFBLOCK_SIZE) + 10, MIFARE_KEY_SIZE);
|
||||
if (mfIsSectorTrailer(i) == false) {
|
||||
continue;
|
||||
}
|
||||
uint8_t sec = MIN(sectors, mfSectorNum(i));
|
||||
e_sector[sec].foundKey[0] = 1;
|
||||
e_sector[sec].Key[0] = bytes_to_num(d + (i * MFBLOCK_SIZE), MIFARE_KEY_SIZE);
|
||||
e_sector[sec].foundKey[1] = 1;
|
||||
e_sector[sec].Key[1] = bytes_to_num(d + (i * MFBLOCK_SIZE) + 10, MIFARE_KEY_SIZE);
|
||||
}
|
||||
printKeyTable(sectors, e_sector);
|
||||
free(e_sector);
|
||||
|
|
Loading…
Reference in a new issue