From 2245673262aea9d9d8935bae2a0ac6985b31d628 Mon Sep 17 00:00:00 2001 From: merlokk <807634+merlokk@users.noreply.github.com> Date: Mon, 3 Dec 2018 18:46:11 +0200 Subject: [PATCH] fix search big loop --- client/emv/emvcore.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/client/emv/emvcore.c b/client/emv/emvcore.c index f2acda25c..b0a474fc7 100644 --- a/client/emv/emvcore.c +++ b/client/emv/emvcore.c @@ -260,6 +260,10 @@ int EMVExchangeEx(bool ActivateField, bool LeaveFieldON, sAPDU apdu, bool Includ if (APDULogging) PrintAndLogEx(NORMAL, "<<<< %s", sprint_hex(Result, *ResultLen)); + if (*ResultLen < 2) { + return 200; + } + *ResultLen -= 2; isw = Result[*ResultLen] * 0x0100 + Result[*ResultLen + 1]; if (sw) @@ -400,8 +404,8 @@ int EMVSearch(bool ActivateField, bool LeaveFieldON, bool decodeTLV, struct tlvd if (++retrycnt < 3){ i--; } else { - // card select error, proxmark error - if (res == 1) { + // (1) - card select error, proxmark error OR (200) - result length = 0 + if (res == 1 || res == 200) { PrintAndLogEx(WARNING, "Exit..."); return 1; }