mirror of
https://github.com/Proxmark/proxmark3.git
synced 2024-09-20 14:56:21 +08:00
Fix CmdSmartUpgrade GCC8 strncpy specified bound depends on the length of the source argument warning (#755)
This commit is contained in:
parent
d9de20fa4b
commit
e59481c119
|
@ -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");
|
||||
|
|
Loading…
Reference in a new issue