From 470a0a59784c72cbde25ad1b4c44cd477e68446a Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Fri, 9 Oct 2020 20:46:48 +0200 Subject: [PATCH] actually fix the list options --- client/src/cmdhf14a.c | 4 +++- client/src/cmdhf14b.c | 4 +++- client/src/cmdhf15.c | 4 +++- client/src/cmdhfcryptorf.c | 4 +++- client/src/cmdhffelica.c | 4 +++- client/src/cmdhffido.c | 4 +++- client/src/cmdhficlass.c | 4 +++- client/src/cmdhflegic.c | 4 +++- client/src/cmdhflto.c | 4 +++- client/src/cmdhfmf.c | 4 +++- client/src/cmdhfmfdes.c | 4 +++- client/src/cmdhfst.c | 4 +++- client/src/cmdhfthinfilm.c | 4 +++- client/src/cmdhftopaz.c | 4 +++- client/src/cmdlfhitag.c | 4 +++- client/src/cmdsmartcard.c | 4 +++- client/src/emv/cmdemv.c | 9 +++++++-- 17 files changed, 55 insertions(+), 18 deletions(-) diff --git a/client/src/cmdhf14a.c b/client/src/cmdhf14a.c index 2297b19f7..eebecc747 100644 --- a/client/src/cmdhf14a.c +++ b/client/src/cmdhf14a.c @@ -269,9 +269,11 @@ static int usage_hf_14a_reader(void) { } static int CmdHF14AList(const char *Cmd) { - char args[128]; + char args[128] = {0}; if (strlen(Cmd) == 0) { snprintf(args, sizeof(args), "-t 14a"); + } else { + strncpy(args, Cmd, sizeof(args) - 1); } return CmdTraceList(args); } diff --git a/client/src/cmdhf14b.c b/client/src/cmdhf14b.c index b13e76887..9056b26a9 100644 --- a/client/src/cmdhf14b.c +++ b/client/src/cmdhf14b.c @@ -116,9 +116,11 @@ static bool wait_cmd_14b(bool verbose, bool is_select) { } static int CmdHF14BList(const char *Cmd) { - char args[128]; + char args[128] = {0}; if (strlen(Cmd) == 0) { snprintf(args, sizeof(args), "-t 14b"); + } else { + strncpy(args, Cmd, sizeof(args) - 1); } return CmdTraceList(args); } diff --git a/client/src/cmdhf15.c b/client/src/cmdhf15.c index 0b370f7bc..9f89da196 100644 --- a/client/src/cmdhf15.c +++ b/client/src/cmdhf15.c @@ -1342,9 +1342,11 @@ static int CmdHF15Dump(const char *Cmd) { } static int CmdHF15List(const char *Cmd) { - char args[128]; + char args[128] = {0}; if (strlen(Cmd) == 0) { snprintf(args, sizeof(args), "-t 15"); + } else { + strncpy(args, Cmd, sizeof(args) - 1); } return CmdTraceList(args); } diff --git a/client/src/cmdhfcryptorf.c b/client/src/cmdhfcryptorf.c index d2ee539db..bf2df530c 100644 --- a/client/src/cmdhfcryptorf.c +++ b/client/src/cmdhfcryptorf.c @@ -115,9 +115,11 @@ static int switch_off_field_cryptorf(void) { } static int CmdHFCryptoRFList(const char *Cmd) { - char args[128]; + char args[128] = {0}; if (strlen(Cmd) == 0) { snprintf(args, sizeof(args), "-t cryptorf"); + } else { + strncpy(args, Cmd, sizeof(args) - 1); } return CmdTraceList(args); } diff --git a/client/src/cmdhffelica.c b/client/src/cmdhffelica.c index ee926c550..083e69b21 100644 --- a/client/src/cmdhffelica.c +++ b/client/src/cmdhffelica.c @@ -407,9 +407,11 @@ static bool add_last_IDm(uint8_t position, uint8_t *data) { } static int CmdHFFelicaList(const char *Cmd) { - char args[128]; + char args[128] = {0}; if (strlen(Cmd) == 0) { snprintf(args, sizeof(args), "-t felica"); + } else { + strncpy(args, Cmd, sizeof(args) - 1); } return CmdTraceList(args); } diff --git a/client/src/cmdhffido.c b/client/src/cmdhffido.c index fc3d3540f..a0bd2267f 100644 --- a/client/src/cmdhffido.c +++ b/client/src/cmdhffido.c @@ -41,9 +41,11 @@ static int CmdHelp(const char *Cmd); static int cmd_hf_fido_list(const char *Cmd) { - char args[128]; + char args[128] = {0}; if (strlen(Cmd) == 0) { snprintf(args, sizeof(args), "-t 14a"); + } else { + strncpy(args, Cmd, sizeof(args) - 1); } return CmdTraceList(args); } diff --git a/client/src/cmdhficlass.c b/client/src/cmdhficlass.c index 87ce3e9cf..28b710fe8 100644 --- a/client/src/cmdhficlass.c +++ b/client/src/cmdhficlass.c @@ -604,9 +604,11 @@ static void print_picopass_header(const picopass_hdr *hdr) { } static int CmdHFiClassList(const char *Cmd) { - char args[128]; + char args[128] = {0}; if (strlen(Cmd) == 0) { snprintf(args, sizeof(args), "-t iclass"); + } else { + strncpy(args, Cmd, sizeof(args) - 1); } return CmdTraceList(args); } diff --git a/client/src/cmdhflegic.c b/client/src/cmdhflegic.c index 6da888ff1..481d1f1bc 100644 --- a/client/src/cmdhflegic.c +++ b/client/src/cmdhflegic.c @@ -1401,9 +1401,11 @@ static int CmdLegicWipe(const char *Cmd) { } static int CmdLegicList(const char *Cmd) { - char args[128]; + char args[128] = {0}; if (strlen(Cmd) == 0) { snprintf(args, sizeof(args), "-t legic"); + } else { + strncpy(args, Cmd, sizeof(args) - 1); } return CmdTraceList(args); } diff --git a/client/src/cmdhflto.c b/client/src/cmdhflto.c index 0e2df52e2..7313d23fb 100644 --- a/client/src/cmdhflto.c +++ b/client/src/cmdhflto.c @@ -207,9 +207,11 @@ int infoLTO(bool verbose) { } static int CmdHfLTOList(const char *Cmd) { - char args[128]; + char args[128] = {0}; if (strlen(Cmd) == 0) { snprintf(args, sizeof(args), "-t lto"); + } else { + strncpy(args, Cmd, sizeof(args) - 1); } return CmdTraceList(args); } diff --git a/client/src/cmdhfmf.c b/client/src/cmdhfmf.c index e0c52de2f..f197194d4 100644 --- a/client/src/cmdhfmf.c +++ b/client/src/cmdhfmf.c @@ -5196,9 +5196,11 @@ static int CmdHFMFPersonalize(const char *cmd) { } static int CmdHF14AMfList(const char *Cmd) { - char args[128]; + char args[128] = {0}; if (strlen(Cmd) == 0) { snprintf(args, sizeof(args), "-t mf"); + } else { + strncpy(args, Cmd, sizeof(args) - 1); } return CmdTraceList(args); } diff --git a/client/src/cmdhfmfdes.c b/client/src/cmdhfmfdes.c index 4ad346f8f..4ffebe47c 100644 --- a/client/src/cmdhfmfdes.c +++ b/client/src/cmdhfmfdes.c @@ -4470,9 +4470,11 @@ static int CmdHF14aDesChk(const char *Cmd) { } static int CmdHF14ADesList(const char *Cmd) { - char args[128]; + char args[128] = {0}; if (strlen(Cmd) == 0) { snprintf(args, sizeof(args), "-t des"); + } else { + strncpy(args, Cmd, sizeof(args) - 1); } return CmdTraceList(args); } diff --git a/client/src/cmdhfst.c b/client/src/cmdhfst.c index 021e9059d..39b47146c 100644 --- a/client/src/cmdhfst.c +++ b/client/src/cmdhfst.c @@ -724,9 +724,11 @@ static int cmd_hf_st_pwd(const char *Cmd) { } static int cmd_hf_st_list(const char *Cmd) { - char args[128]; + char args[128] = {0}; if (strlen(Cmd) == 0) { snprintf(args, sizeof(args), "-t 7816"); + } else { + strncpy(args, Cmd, sizeof(args) - 1); } return CmdTraceList(args); } diff --git a/client/src/cmdhfthinfilm.c b/client/src/cmdhfthinfilm.c index b8fbe3798..34001be44 100644 --- a/client/src/cmdhfthinfilm.c +++ b/client/src/cmdhfthinfilm.c @@ -225,9 +225,11 @@ static int CmdHfThinFilmSim(const char *Cmd) { } static int CmdHfThinFilmList(const char *Cmd) { - char args[128]; + char args[128] = {0}; if (strlen(Cmd) == 0) { snprintf(args, sizeof(args), "-t thinfilm"); + } else { + strncpy(args, Cmd, sizeof(args) - 1); } return CmdTraceList(args); } diff --git a/client/src/cmdhftopaz.c b/client/src/cmdhftopaz.c index 8a99fea73..a64071c97 100644 --- a/client/src/cmdhftopaz.c +++ b/client/src/cmdhftopaz.c @@ -481,9 +481,11 @@ static int CmdHFTopazCmdRaw(const char *Cmd) { } static int CmdHFTopazList(const char *Cmd) { - char args[128]; + char args[128] = {0}; if (strlen(Cmd) == 0) { snprintf(args, sizeof(args), "-t topaz"); + } else { + strncpy(args, Cmd, sizeof(args) - 1); } return CmdTraceList(args); } diff --git a/client/src/cmdlfhitag.c b/client/src/cmdlfhitag.c index 957542a84..8457b7bce 100644 --- a/client/src/cmdlfhitag.c +++ b/client/src/cmdlfhitag.c @@ -149,9 +149,11 @@ static int usage_hitag_checkchallenges(void) { } static int CmdLFHitagList(const char *Cmd) { - char args[128]; + char args[128] = {0}; if (strlen(Cmd) == 0) { snprintf(args, sizeof(args), "-t hitag2"); + } else { + strncpy(args, Cmd, sizeof(args) - 1); } return CmdTraceList(args); diff --git a/client/src/cmdsmartcard.c b/client/src/cmdsmartcard.c index cd6f02a32..dc8205948 100644 --- a/client/src/cmdsmartcard.c +++ b/client/src/cmdsmartcard.c @@ -844,9 +844,11 @@ static int CmdSmartSetClock(const char *Cmd) { } static int CmdSmartList(const char *Cmd) { - char args[128]; + char args[128] = {0}; if (strlen(Cmd) == 0) { snprintf(args, sizeof(args), "-t 7816"); + } else { + strncpy(args, Cmd, sizeof(args) - 1); } return CmdTraceList(args); } diff --git a/client/src/emv/cmdemv.c b/client/src/emv/cmdemv.c index 57f898425..95134251b 100644 --- a/client/src/emv/cmdemv.c +++ b/client/src/emv/cmdemv.c @@ -1772,8 +1772,13 @@ static int CmdEMVScan(const char *Cmd) { } static int CmdEMVList(const char *Cmd) { - (void)Cmd; // Cmd is not used so far - return CmdTraceList("7816"); + char args[128] = {0}; + if (strlen(Cmd) == 0) { + snprintf(args, sizeof(args), "-t 7816"); + } else { + strncpy(args, Cmd, sizeof(args) - 1); + } + return CmdTraceList(args); } static int CmdEMVTest(const char *Cmd) {