Merge pull request #261 from merlokk/emv_sea_bug

fix emv search keep field bug
This commit is contained in:
Oleg Moiseenko 2019-07-17 12:00:02 +03:00 committed by GitHub
commit 7c6facce94
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -532,7 +532,7 @@ int EMVSearch(EMVCommandChannel channel, bool ActivateField, bool LeaveFieldON,
int retrycnt = 0;
for (int i = 0; i < AIDlistLen; i ++) {
param_gethex_to_eol(AIDlist[i].aid, 0, aidbuf, sizeof(aidbuf), &aidlen);
res = EMVSelect(channel, (i == 0) ? ActivateField : false, (i == AIDlistLen - 1) ? LeaveFieldON : true, aidbuf, aidlen, data, sizeof(data), &datalen, &sw, tlv);
res = EMVSelect(channel, (i == 0) ? ActivateField : false, true, aidbuf, aidlen, data, sizeof(data), &datalen, &sw, tlv);
// retry if error and not returned sw error
if (res && res != 5) {
if (++retrycnt < 3) {
@ -540,6 +540,9 @@ int EMVSearch(EMVCommandChannel channel, bool ActivateField, bool LeaveFieldON,
} else {
// (1) - card select error, proxmark error OR (200) - result length = 0
if (res == 1 || res == 200) {
if (!LeaveFieldON)
DropFieldEx(channel);
PrintAndLogEx(WARNING, "Exit...");
return 1;
}
@ -563,6 +566,9 @@ int EMVSearch(EMVCommandChannel channel, bool ActivateField, bool LeaveFieldON,
}
}
if (!LeaveFieldON)
DropFieldEx(channel);
return 0;
}