From 154d3ff22255ee9c5d1390a8a4932f0d0c9ec7e4 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Tue, 6 Oct 2020 15:54:56 +0200 Subject: [PATCH] bad copies --- client/src/cmdcrc.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/client/src/cmdcrc.c b/client/src/cmdcrc.c index 8830f5530..472a361fe 100644 --- a/client/src/cmdcrc.c +++ b/client/src/cmdcrc.c @@ -25,6 +25,7 @@ #include "reveng.h" #include "ui.h" #include "util.h" +#include "pm3_cmd.h" #define MAX_ARGS 20 @@ -497,12 +498,12 @@ static int CmdrevengSearch(const char *Cmd) { } int CmdCrc(const char *Cmd) { - char name[] = {"reveng "}; - char Cmd2[100 + 7]; - memcpy(Cmd2, name, 7); - memcpy(Cmd2 + 7, Cmd, 100); + char c[100 + 7]; + snprintf(c, sizeof(c), "reveng "); + snprintf(c + strlen(c), sizeof(c) - strlen(c), Cmd, strlen(Cmd)); + char *argv[MAX_ARGS]; - int argc = split(Cmd2, argv); + int argc = split(c, argv); if (argc == 3 && memcmp(argv[1], "-g", 2) == 0) { CmdrevengSearch(argv[2]); @@ -512,6 +513,6 @@ int CmdCrc(const char *Cmd) { for (int i = 0; i < argc; ++i) { free(argv[i]); } - return 0; + return PM3_SUCCESS; }