]> cvs.zerfleddert.de Git - proxmark3-svn/commitdiff
Fix CmdSmartUpgrade GCC8 strncpy specified bound depends on the length of the source...
authorFl0-0 <Fl0-0@users.noreply.github.com>
Sun, 13 Jan 2019 15:53:09 +0000 (16:53 +0100)
committerpwpiwi <pwpiwi@users.noreply.github.com>
Sun, 13 Jan 2019 15:53:09 +0000 (16:53 +0100)
client/cmdsmartcard.c

index 80cbec462f79d6f0c30aa77f79fdf114fc2b571e..8f3d8d2e5d08e40663f394a3f2e38e53ed3b87bd 100644 (file)
@@ -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");
Impressum, Datenschutz