Fix off-by-one memory issue
This commit is contained in:
parent
0a1fa331f8
commit
4f67b9db17
7
minrss.c
7
minrss.c
@ -56,15 +56,16 @@ itemAction(itemStruct *item, const char *folder)
|
|||||||
memcpy(filePath, folder, folderLen * sizeof(char));
|
memcpy(filePath, folder, folderLen * sizeof(char));
|
||||||
|
|
||||||
filePath[folderLen] = fsep();
|
filePath[folderLen] = fsep();
|
||||||
filePath[pathLen] = '\0';
|
filePath[pathLen - 1] = '\0';
|
||||||
|
|
||||||
memcpy(filePath + folderLen + 1, fileName, fileNameLen * sizeof(char));
|
memcpy(filePath + folderLen + 1, fileName, fileNameLen * sizeof(char));
|
||||||
free(fileName);
|
|
||||||
|
|
||||||
memcpy(filePath + pathLen - extLen - 1, fileExt, extLen * sizeof(char));
|
memcpy(filePath + pathLen - extLen - 1, fileExt, extLen * sizeof(char));
|
||||||
|
|
||||||
FILE *itemFile = fopen(filePath, "a");
|
FILE *itemFile = fopen(filePath, "a");
|
||||||
|
|
||||||
free(filePath);
|
free(filePath);
|
||||||
|
free(fileName);
|
||||||
|
|
||||||
|
|
||||||
// Do not overwrite files
|
// Do not overwrite files
|
||||||
if (!ftell(itemFile)) {
|
if (!ftell(itemFile)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user