From 033a734ceb54b45a23965a46642ae34a0f57c3ff Mon Sep 17 00:00:00 2001 From: achazal Date: Tue, 24 Mar 2026 10:49:59 +0100 Subject: [PATCH] fix(pcsc): remove infinite loop and buffer overflow in `smart pcsc` --- client/src/cmdsmartcard.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/src/cmdsmartcard.c b/client/src/cmdsmartcard.c index 5d01f9a9d..6af48d90c 100644 --- a/client/src/cmdsmartcard.c +++ b/client/src/cmdsmartcard.c @@ -1312,7 +1312,7 @@ static int CmdPCSC(const char *Cmd) { } } - uint8_t res[22] = {0}; + uint8_t res[2 + 256] = {0}; res[1] = atrLen; memcpy(res + 2, atr, atrLen); mbedtls_net_send(&netCtx, res, 2 + atrLen); @@ -1393,7 +1393,7 @@ static int CmdPCSC(const char *Cmd) { // ISO 15. - if (use_contact && IfPm3Iso14443() && smart_select(false, &card) == PM3_SUCCESS) { + if (use_contact && IfPm3Iso14443() && smart_select(false, &card)) { have_card = true; card_type = CC_CONTACT; }