From 80d07bcaac284a936ab50b583d3f594761d53792 Mon Sep 17 00:00:00 2001 From: merlokk <807634+merlokk@users.noreply.github.com> Date: Thu, 6 Dec 2018 20:04:28 +0200 Subject: [PATCH] added code if AIP not found --- client/emv/cmdemv.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/client/emv/cmdemv.c b/client/emv/cmdemv.c index 0ddf4e035..647123faf 100644 --- a/client/emv/cmdemv.c +++ b/client/emv/cmdemv.c @@ -895,11 +895,16 @@ int CmdEMVExec(const char *cmd) { tlvdb_add(tlvRoot, oda); PrintAndLogEx(NORMAL, "* Input list for Offline Data Authentication added to TLV. len=%d \n", ODAiListLen); } - + // get AIP + uint16_t AIP = 0; const struct tlv *AIPtlv = tlvdb_get(tlvRoot, 0x82, NULL); - uint16_t AIP = AIPtlv->value[0] + AIPtlv->value[1] * 0x100; - PrintAndLogEx(NORMAL, "* * AIP=%04x", AIP); + if (AIPtlv) { + AIP = AIPtlv->value[0] + AIPtlv->value[1] * 0x100; + PrintAndLogEx(NORMAL, "* * AIP=%04x", AIP); + } else { + PrintAndLogEx(ERR, "Can't found AIP."); + } // SDA if (AIP & 0x0040) {