REVIEWED: FileMove(), additional security checks
This commit is contained in:
parent
725c8b57ae
commit
6ae16c9895
|
|
@ -2283,7 +2283,10 @@ int FileMove(const char *srcPath, const char *dstPath)
|
||||||
|
|
||||||
if (FileExists(srcPath))
|
if (FileExists(srcPath))
|
||||||
{
|
{
|
||||||
if (FileCopy(srcPath, dstPath)) result = FileRemove(srcPath);
|
FileCopy(srcPath, dstPath);
|
||||||
|
|
||||||
|
// Make sure file has been correctly copied before removing
|
||||||
|
if (FileExists(dstPath) && (GetFileLength(srcPath) == GetFileLength(dstPath))) result = FileRemove(srcPath);
|
||||||
else TRACELOG(LOG_WARNING, "FILEIO: [%s] Failed to copy file to [%s]", srcPath, dstPath);
|
else TRACELOG(LOG_WARNING, "FILEIO: [%s] Failed to copy file to [%s]", srcPath, dstPath);
|
||||||
}
|
}
|
||||||
else TRACELOG(LOG_WARNING, "FILEIO: [%s] Source file does not exist", srcPath);
|
else TRACELOG(LOG_WARNING, "FILEIO: [%s] Source file does not exist", srcPath);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user