Fix MAD1 off-by-one in MADDecode: loop read Key A as 16th AID
This commit is contained in:
2 files changed
+3
-4
No files matched your search
@@ -262,8 +262,7 @@ int MADDecode(uint8_t *sector0, uint8_t *sector16, uint16_t *mad, size_t *madlen
|
|||||||
PrintAndLogEx(INFO, "overriding crc check");
|
PrintAndLogEx(INFO, "overriding crc check");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 7 + 8 == 15
|
for (int i = 1; i < 16; i++) {
|
||||||
for (int i = 1; i <= 16; i++) {
|
|
||||||
mad[*madlen] = madGetAID(sector0, swapmad, 1, i);
|
mad[*madlen] = madGetAID(sector0, swapmad, 1, i);
|
||||||
(*madlen)++;
|
(*madlen)++;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,8 +21,8 @@
|
|||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
// 16 MAD1 AIDs + 1 MAD2 marker (0x0005) + 23 MAD2 AIDs = 40
|
// 15 MAD1 AIDs (sectors 1-15) + 1 MAD2 marker (0x0005) + 23 MAD2 AIDs (sectors 17-39) = 39
|
||||||
#define MAD_MAX_AID_ENTRIES 40
|
#define MAD_MAX_AID_ENTRIES 39
|
||||||
|
|
||||||
int MADCheck(uint8_t *sector0, uint8_t *sector16, bool verbose, bool *haveMAD2);
|
int MADCheck(uint8_t *sector0, uint8_t *sector16, bool verbose, bool *haveMAD2);
|
||||||
int MADDecode(uint8_t *sector0, uint8_t *sector16, uint16_t *mad, size_t *madlen, bool swapmad, bool override);
|
int MADDecode(uint8_t *sector0, uint8_t *sector16, uint16_t *mad, size_t *madlen, bool swapmad, bool override);
|
||||||
|
|||||||
Reference in new issue
Block a user