mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 21:33:47 -07:00
fix: 'hf 14a info' - ATS length sanity check added
This commit is contained in:
parent
7e0455aa0c
commit
fd7acc78f3
1 changed files with 6 additions and 4 deletions
|
@ -414,9 +414,12 @@ int CmdHF14AInfo(const char *Cmd) {
|
||||||
tb1 = (card.ats[1] & 0x20) == 0x20;
|
tb1 = (card.ats[1] & 0x20) == 0x20;
|
||||||
tc1 = (card.ats[1] & 0x40) == 0x40;
|
tc1 = (card.ats[1] & 0x40) == 0x40;
|
||||||
int16_t fsci = card.ats[1] & 0x0f;
|
int16_t fsci = card.ats[1] & 0x0f;
|
||||||
|
|
||||||
PrintAndLogEx(NORMAL, " - T0 : TA1 is%s present, TB1 is%s present, "
|
PrintAndLogEx(NORMAL, " - T0 : TA1 is%s present, TB1 is%s present, "
|
||||||
"TC1 is%s present, FSCI is %d (FSC = %ld)",
|
"TC1 is%s present, FSCI is %d (FSC = %ld)",
|
||||||
(ta1 ? "" : " NOT"), (tb1 ? "" : " NOT"), (tc1 ? "" : " NOT"),
|
(ta1 ? "" : " NOT"),
|
||||||
|
(tb1 ? "" : " NOT"),
|
||||||
|
(tc1 ? "" : " NOT"),
|
||||||
fsci,
|
fsci,
|
||||||
fsci < 5 ? (fsci - 2) * 8 :
|
fsci < 5 ? (fsci - 2) * 8 :
|
||||||
fsci < 8 ? (fsci - 3) * 32 :
|
fsci < 8 ? (fsci - 3) * 32 :
|
||||||
|
@ -459,7 +462,7 @@ int CmdHF14AInfo(const char *Cmd) {
|
||||||
(card.ats[pos] & 0x02) ? "" : " NOT");
|
(card.ats[pos] & 0x02) ? "" : " NOT");
|
||||||
pos++;
|
pos++;
|
||||||
}
|
}
|
||||||
if (card.ats[0] > pos) {
|
if (card.ats[0] > pos && card.ats[0] < card.ats_len - 2 ) {
|
||||||
char *tip = "";
|
char *tip = "";
|
||||||
if (card.ats[0] - pos >= 7) {
|
if (card.ats[0] - pos >= 7) {
|
||||||
if (memcmp(card.ats + pos, "\xC1\x05\x2F\x2F\x01\xBC\xD6", 7) == 0) {
|
if (memcmp(card.ats + pos, "\xC1\x05\x2F\x2F\x01\xBC\xD6", 7) == 0) {
|
||||||
|
@ -471,8 +474,7 @@ int CmdHF14AInfo(const char *Cmd) {
|
||||||
PrintAndLogEx(NORMAL, " - HB : %s%s", sprint_hex(card.ats + pos, card.ats[0] - pos), tip);
|
PrintAndLogEx(NORMAL, " - HB : %s%s", sprint_hex(card.ats + pos, card.ats[0] - pos), tip);
|
||||||
if (card.ats[pos] == 0xC1) {
|
if (card.ats[pos] == 0xC1) {
|
||||||
PrintAndLogEx(NORMAL, " c1 -> Mifare or (multiple) virtual cards of various type");
|
PrintAndLogEx(NORMAL, " c1 -> Mifare or (multiple) virtual cards of various type");
|
||||||
PrintAndLogEx(NORMAL, " %02x -> Length is %d bytes",
|
PrintAndLogEx(NORMAL, " %02x -> Length is %d bytes", card.ats[pos + 1], card.ats[pos + 1]);
|
||||||
card.ats[pos + 1], card.ats[pos + 1]);
|
|
||||||
switch (card.ats[pos + 2] & 0xf0) {
|
switch (card.ats[pos + 2] & 0xf0) {
|
||||||
case 0x10: PrintAndLogEx(NORMAL, " 1x -> MIFARE DESFire"); break;
|
case 0x10: PrintAndLogEx(NORMAL, " 1x -> MIFARE DESFire"); break;
|
||||||
case 0x20: PrintAndLogEx(NORMAL, " 2x -> MIFARE Plus"); break;
|
case 0x20: PrintAndLogEx(NORMAL, " 2x -> MIFARE Plus"); break;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue