From d7e6b5d6a14827344d22a90ea225880972dda327 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Fri, 27 Apr 2018 16:47:29 +0200 Subject: [PATCH] chg: 'lf hitag list' - getfrombigbuf has now timeout --- client/cmdlfhitag.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/client/cmdlfhitag.c b/client/cmdlfhitag.c index d248a2133..c6a023cd5 100644 --- a/client/cmdlfhitag.c +++ b/client/cmdlfhitag.c @@ -40,7 +40,12 @@ int CmdLFHitagList(const char *Cmd) { // Query for the actual size of the trace UsbCommand response; GetFromBigBuf(got, USB_CMD_DATA_SIZE, 0); - WaitForResponse(CMD_ACK, &response); + if ( !WaitForResponseTimeout(CMD_ACK, &response, 2500) ) { + PrintAndLogEx(WARNING, "command execution time out"); + free(got); + return 2; + } + uint16_t traceLen = response.arg[2]; if (traceLen > USB_CMD_DATA_SIZE) { uint8_t *p = realloc(got, traceLen); @@ -51,7 +56,11 @@ int CmdLFHitagList(const char *Cmd) { } got = p; GetFromBigBuf(got, traceLen, 0); - WaitForResponse(CMD_ACK,NULL); + if ( !WaitForResponseTimeout(CMD_ACK, NULL, 2500) ) { + PrintAndLogEx(WARNING, "command execution time out"); + free(got); + return 2; + } } PrintAndLogEx(NORMAL, "recorded activity (TraceLen = %d bytes):");