mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 22:03:42 -07:00
lets see if this sorts out the memory crash on pentoo
This commit is contained in:
parent
1a4df13aae
commit
cb9ee94ed6
1 changed files with 4 additions and 3 deletions
|
@ -210,18 +210,19 @@ char *newfilenamemcopyEx(const char *preferredName, const char *suffix, savePath
|
||||||
pfn += save_path_len + strlen(PATHSEP);
|
pfn += save_path_len + strlen(PATHSEP);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t p_namelen = strlen(preferredName);
|
// remove file extension if exist in name
|
||||||
|
size_t p_namelen = strlen(preferredName);
|
||||||
if (str_endswith(preferredName, suffix)) {
|
if (str_endswith(preferredName, suffix)) {
|
||||||
p_namelen -= strlen(suffix);
|
p_namelen -= strlen(suffix);
|
||||||
}
|
}
|
||||||
// modify filename
|
// modify filename
|
||||||
snprintf(pfn, len, "%.*s%s", p_namelen, preferredName, suffix);
|
snprintf(pfn, len, "%.*s%s", (int)p_namelen, preferredName, suffix);
|
||||||
|
|
||||||
// check complete path/filename if exists
|
// check complete path/filename if exists
|
||||||
int num = 1;
|
int num = 1;
|
||||||
while (fileExists(fileName)) {
|
while (fileExists(fileName)) {
|
||||||
// modify filename
|
// modify filename
|
||||||
snprintf(pfn, len, "%.*s-%03d%s", p_namelen, preferredName, num, suffix);
|
snprintf(pfn, len, "%.*s-%03d%s", (int)p_namelen, preferredName, num, suffix);
|
||||||
num++;
|
num++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue