From 493383c99571181e8644376b3d5741ea4afa9c9a Mon Sep 17 00:00:00 2001 From: wh201906 Date: Fri, 24 Nov 2023 22:18:06 +0800 Subject: [PATCH] Fix ExchangeAPDUSC() in cmdsmartcard.c It doesn't return 1 if the retry fails, which is different from the behavior of the first try. --- client/src/cmdsmartcard.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/client/src/cmdsmartcard.c b/client/src/cmdsmartcard.c index 488e5b9d8..e8f3c8eb9 100644 --- a/client/src/cmdsmartcard.c +++ b/client/src/cmdsmartcard.c @@ -1417,6 +1417,10 @@ int ExchangeAPDUSC(bool verbose, uint8_t *datain, int datainlen, bool activateCa SendCommandNG(CMD_SMART_RAW, (uint8_t *)payload, sizeof(smart_card_raw_t) + 5); datain[4] = 0; len = smart_responseEx(dataout, maxdataoutlen, verbose); + if (len < 0) { + free(payload); + return 1; + } } free(payload);