From: Fl0-0 Date: Sun, 13 Jan 2019 15:53:09 +0000 (+0100) Subject: Fix CmdSmartUpgrade GCC8 strncpy specified bound depends on the length of the source... X-Git-Url: http://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/commitdiff_plain/e59481c119ded9068958d080e678ddd5c7fcdd48?hp=d9de20fa4bb0a36052927b55c4185caa204c5c4d;ds=sidebyside Fix CmdSmartUpgrade GCC8 strncpy specified bound depends on the length of the source argument warning (#755) --- diff --git a/client/cmdsmartcard.c b/client/cmdsmartcard.c index 80cbec46..8f3d8d2e 100644 --- a/client/cmdsmartcard.c +++ b/client/cmdsmartcard.c @@ -581,7 +581,7 @@ int CmdSmartUpgrade(const char *Cmd) { return 1; } - char sha512filename[FILE_PATH_SIZE]; + char sha512filename[FILE_PATH_SIZE] = {'\0'}; char *bin_extension = filename; char *dot_position = NULL; while ((dot_position = strchr(bin_extension, '.')) != NULL) { @@ -592,7 +592,7 @@ int CmdSmartUpgrade(const char *Cmd) { || !strcmp(bin_extension, "bin") #endif ) { - strncpy(sha512filename, filename, strlen(filename) - strlen("bin")); + memcpy(sha512filename, filename, strlen(filename) - strlen("bin")); strcat(sha512filename, "sha512.txt"); } else { PrintAndLogEx(FAILED, "Filename extension of Firmware Upgrade File must be .BIN");