From 2c4db1ce7c37528fb343d57841a6c3cddcd4a357 Mon Sep 17 00:00:00 2001 From: merlokk <807634+merlokk@users.noreply.github.com> Date: Wed, 20 Feb 2019 19:37:30 +0200 Subject: [PATCH] check ATR length --- client/emv/cmdemv.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/client/emv/cmdemv.c b/client/emv/cmdemv.c index 9bb71de76..9728a32b7 100644 --- a/client/emv/cmdemv.c +++ b/client/emv/cmdemv.c @@ -1444,6 +1444,10 @@ int CmdEMVScan(const char *cmd) { smart_card_atr_t card; smart_select(true, &card); + if (!card.atr_len) { + PrintAndLogEx(ERR, "Can't get ATR from a smart card."); + return 1; + } JsonSaveStr(root, "$.Card.Contact.Communication", "iso7816"); JsonSaveBufAsHex(root, "$.Card.Contact.ATR", (uint8_t *)card.atr, card.atr_len);