From ab7a8ea16420243ad132b21f968ea15a3b14fa61 Mon Sep 17 00:00:00 2001 From: "martin.holst@gmail.com" Date: Mon, 3 Jun 2013 11:04:35 +0000 Subject: [PATCH] Fixed error pointed out here: https://code.google.com/p/proxmark3/issues/detail?id=46, when null is passed to waitforresponse --- client/cmdmain.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/client/cmdmain.c b/client/cmdmain.c index 7f34d543..85a0e0ca 100644 --- a/client/cmdmain.c +++ b/client/cmdmain.c @@ -26,9 +26,9 @@ #include "util.h" unsigned int current_command = CMD_UNKNOWN; -unsigned int received_command = CMD_UNKNOWN; -UsbCommand current_response; -UsbCommand current_response_user; +//unsigned int received_command = CMD_UNKNOWN; +//UsbCommand current_response; +//UsbCommand current_response_user; static int CmdHelp(const char *Cmd); static int CmdQuit(const char *Cmd); @@ -74,6 +74,11 @@ int CmdQuit(const char *Cmd) * @return true if command was returned, otherwise false */ bool WaitForResponseTimeout(uint32_t cmd, UsbCommand* response, size_t ms_timeout) { + + if (response == NULL) { + UsbCommand resp; + response = &resp; + } // Wait until the command is received for(size_t dm_seconds=0; dm_seconds < ms_timeout/10; dm_seconds++) { @@ -175,6 +180,7 @@ void UsbCommandReceived(UsbCommand *UC) default: { // Maybe it's a response + /* switch(current_command) { case CMD_DOWNLOAD_RAW_ADC_SAMPLES_125K: { if (UC->cmd != CMD_DOWNLOADED_RAW_ADC_SAMPLES_125K) { @@ -186,13 +192,14 @@ void UsbCommandReceived(UsbCommand *UC) memcpy(sample_buf+UC->arg[0],UC->d.asBytes,48); sample_buf_len += 48; // for(i=0; i<48; i++) sample_buf[i] = UC->d.asBytes[i]; - received_command = UC->cmd; + //received_command = UC->cmd; } break; default: { } break; - } - } break; + }*/ + } + break; } storeCommand(UC); -- 2.39.2