mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 13:23:51 -07:00
safeFile*: accept when suffix is already provided
This commit is contained in:
parent
405f24522e
commit
1dbcb712c3
13 changed files with 77 additions and 74 deletions
|
@ -938,16 +938,3 @@ char *strmcopy(const char *buf) {
|
|||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
char *filenamemcopy(const char *preferredName, const char *suffix) {
|
||||
if (preferredName == NULL) return NULL;
|
||||
if (suffix == NULL) return NULL;
|
||||
char *fileName = (char *) calloc(strlen(preferredName) + strlen(suffix) + 1, sizeof(uint8_t));
|
||||
if (fileName == NULL)
|
||||
return NULL;
|
||||
strcpy(fileName, preferredName);
|
||||
if (str_endswith(fileName, suffix))
|
||||
return fileName;
|
||||
strcat(fileName, suffix);
|
||||
return fileName;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue