Merge pull request #1482 from AxisRay/fix-global-buffer-overflow

fix buffer overflow
This commit is contained in:
Philippe Teuwen 2021-08-24 10:34:15 +02:00 committed by GitHub
commit 4bcf1750d2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -689,22 +689,22 @@ static int CmdHF14ADesInfo(const char *Cmd) {
iso14a_card_select_t card; iso14a_card_select_t card;
res = SelectCard14443A_4(true, false, &card); res = SelectCard14443A_4(true, false, &card);
if (res == PM3_SUCCESS) { if (res == PM3_SUCCESS) {
static const char STANDALONE_DESFIRE[] = { 0x75, 0x77, 0x81, 0x02}; static const char STANDALONE_DESFIRE[] = { 0x75, 0x77, 0x81, 0x02 };
static const char JCOP_DESFIRE[] = { 0x75, 0xf7, 0xb1, 0x02 }; static const char JCOP_DESFIRE[] = { 0x75, 0xf7, 0xb1, 0x02 };
static const char JCOP3_DESFIRE[] = { 0x78, 0x77, 0x71, 0x02 }; static const char JCOP3_DESFIRE[] = { 0x78, 0x77, 0x71, 0x02 };
if (card.sak == 0x20) { if (card.sak == 0x20) {
if (card.ats_len >= 5) { if (card.ats_len >= 5) {
if (str_startswith((const char *)card.ats + 1, STANDALONE_DESFIRE)) { if (0 == memcmp(card.ats + 1, STANDALONE_DESFIRE, 4)) {
PrintAndLogEx(INFO, "Standalone DESFire"); PrintAndLogEx(INFO, "Standalone DESFire");
} }
if (str_startswith((const char *)card.ats + 1, JCOP_DESFIRE)) { if (0 == memcmp(card.ats + 1, JCOP_DESFIRE, 4)) {
PrintAndLogEx(INFO, "JCOP DESFire"); PrintAndLogEx(INFO, "JCOP DESFire");
} }
} }
if (card.ats_len == 4) { if (card.ats_len == 4) {
if (str_startswith((const char *)card.ats + 1, JCOP3_DESFIRE)) { if (0 == memcmp(card.ats + 1, JCOP3_DESFIRE, 4)) {
PrintAndLogEx(INFO, "JCOP3 DESFire"); PrintAndLogEx(INFO, "JCOP3 DESFire");
} }
} }