mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2026-05-12 11:18:11 -07:00
Merge pull request #3167 from AlxCzl/master
Fix `smart pcsc`: card is never detected and a buffer overflow with 20+ bytes ATRs
This commit is contained in:
@@ -1312,7 +1312,9 @@ static int CmdPCSC(const char *Cmd) {
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t res[22] = {0};
|
||||
// ISO 7816-3 specifies that ATRs can be 2 to 33 bytes long
|
||||
// but some custom cards may support up to 256 bytes long ATRs
|
||||
uint8_t res[2 + 256] = {0};
|
||||
res[1] = atrLen;
|
||||
memcpy(res + 2, atr, atrLen);
|
||||
mbedtls_net_send(&netCtx, res, 2 + atrLen);
|
||||
@@ -1393,7 +1395,7 @@ static int CmdPCSC(const char *Cmd) {
|
||||
|
||||
// ISO 15.
|
||||
|
||||
if (use_contact && IfPm3Iso14443() && smart_select(false, &card) == PM3_SUCCESS) {
|
||||
if (use_contact && IfPm3Iso14443() && smart_select(false, &card)) {
|
||||
have_card = true;
|
||||
card_type = CC_CONTACT;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user