From feddfe7f43e34d5c1b30b74a5bc022b17754ac7c Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Mon, 2 Nov 2020 17:55:48 +0100 Subject: [PATCH] fix coverity 303441, 303442, 303486, 286660 --- client/src/cmdhfmfdes.c | 2 +- client/src/cmdlfem4x05.c | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/client/src/cmdhfmfdes.c b/client/src/cmdhfmfdes.c index 8a16be64e..3ecb516ef 100644 --- a/client/src/cmdhfmfdes.c +++ b/client/src/cmdhfmfdes.c @@ -4476,7 +4476,7 @@ static int CmdHF14aDesChk(const char *Cmd) { PrintAndLogEx(INFO, "Loaded " _YELLOW_("%"PRIu32) " k3kdes keys", k3kkeyListLen); } - if (!verbose) + if (verbose == false) PrintAndLogEx(INFO, "Search keys:"); bool result = false; diff --git a/client/src/cmdlfem4x05.c b/client/src/cmdlfem4x05.c index 134cbaa9f..e1f8e10ad 100644 --- a/client/src/cmdlfem4x05.c +++ b/client/src/cmdlfem4x05.c @@ -1932,10 +1932,12 @@ int CmdEM4x05Sniff(const char *Cmd) { sampleData = !arg_get_lit(ctx, 1); fwd = arg_get_lit(ctx, 2); + CLIParserFree(ctx); + // setup and sample data from Proxmark // if not directed to existing sample/graphbuffer if (sampleData) { - if (!IfPm3Lf()) { + if (IfPm3Lf() == false) { PrintAndLogEx(WARNING, "Only offline mode is available"); return PM3_EINVARG; } @@ -1993,7 +1995,7 @@ int CmdEM4x05Sniff(const char *Cmd) { ((strncmp(bits, "01001", 5) == 0) && (bitidx == 12)) || ((strncmp(bits, "01100", 5) == 0) && (bitidx == 50)) || ((strncmp(bits, "01010", 5) == 0) && (bitidx == 50))) { - memcpy(bits, &bits[1], bitidx - 1); + memmove(bits, &bits[1], bitidx - 1); bitidx--; printf("Trim leading 0\n"); } @@ -2066,9 +2068,9 @@ int CmdEM4x05Sniff(const char *Cmd) { // Print results if (haveData) { //&& (minWidth > 1) && (maxWidth > minWidth)){ if (pwd) - PrintAndLogEx(SUCCESS, "%6llu | %-10s | "_YELLOW_("%8s")" | "_YELLOW_("%3s")" | %s", pktOffset, cmdText, dataText, blkAddr, bits); + PrintAndLogEx(SUCCESS, "%6zu | %-10s | "_YELLOW_("%8s")" | "_YELLOW_("%3s")" | %s", pktOffset, cmdText, dataText, blkAddr, bits); else - PrintAndLogEx(SUCCESS, "%6llu | %-10s | "_GREEN_("%8s")" | "_GREEN_("%3s")" | %s", pktOffset, cmdText, dataText, blkAddr, bits); + PrintAndLogEx(SUCCESS, "%6zu | %-10s | "_GREEN_("%8s")" | "_GREEN_("%3s")" | %s", pktOffset, cmdText, dataText, blkAddr, bits); } }