mirror of
https://github.com/raysan5/raylib.git
synced 2026-06-13 21:01:53 +08:00
REVIEWED: ScanDirectoryFiles*() #4833
Some checks failed
Android / build (arm64) (push) Has been cancelled
Android / build (x86_64) (push) Has been cancelled
CMakeBuilds / Windows Build (push) Has been cancelled
CMakeBuilds / Linux Build (push) Has been cancelled
Linux / build (i386, i386, /user/bin, 32) (push) Has been cancelled
Linux / build (x86_64, amd64, /user/bin, 64) (push) Has been cancelled
Linux Examples / build (push) Has been cancelled
macOS / build (push) Has been cancelled
WebAssembly / build (push) Has been cancelled
Windows / build (ARM64, ARM64, msvc16, winarm64) (push) Has been cancelled
Windows / build (i686, pe-i386, mingw-w64, win32) (push) Has been cancelled
Windows / build (x64, x64, msvc16, win64) (push) Has been cancelled
Windows / build (x86, Win32, msvc16, win32) (push) Has been cancelled
Windows / build (x86_64, pe-x86-64, mingw-w64, win64) (push) Has been cancelled
Windows Examples / build (push) Has been cancelled
Some checks failed
Android / build (arm64) (push) Has been cancelled
Android / build (x86_64) (push) Has been cancelled
CMakeBuilds / Windows Build (push) Has been cancelled
CMakeBuilds / Linux Build (push) Has been cancelled
Linux / build (i386, i386, /user/bin, 32) (push) Has been cancelled
Linux / build (x86_64, amd64, /user/bin, 64) (push) Has been cancelled
Linux Examples / build (push) Has been cancelled
macOS / build (push) Has been cancelled
WebAssembly / build (push) Has been cancelled
Windows / build (ARM64, ARM64, msvc16, winarm64) (push) Has been cancelled
Windows / build (i686, pe-i386, mingw-w64, win32) (push) Has been cancelled
Windows / build (x64, x64, msvc16, win64) (push) Has been cancelled
Windows / build (x86, Win32, msvc16, win32) (push) Has been cancelled
Windows / build (x86_64, pe-x86-64, mingw-w64, win64) (push) Has been cancelled
Windows Examples / build (push) Has been cancelled
This commit is contained in:
parent
654d5c80c2
commit
749a512f13
12
src/rcore.c
12
src/rcore.c
@ -3688,12 +3688,12 @@ static void ScanDirectoryFiles(const char *basePath, FilePathList *files, const
|
||||
(strcmp(dp->d_name, "..") != 0))
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
int realPathLength = snprintf(path, sizeof(path) - 1, "%s\\%s", basePath, dp->d_name);
|
||||
int pathLength = snprintf(path, MAX_FILEPATH_LENGTH - 1, "%s\\%s", basePath, dp->d_name);
|
||||
#else
|
||||
int realPathLength = snprintf(path, sizeof(path) - 1, "%s/%s", basePath, dp->d_name);
|
||||
int pathLength = snprintf(path, MAX_FILEPATH_LENGTH - 1, "%s/%s", basePath, dp->d_name);
|
||||
#endif
|
||||
|
||||
if (realPathLength < 0 || realPathLength >= sizeof(path))
|
||||
if ((pathLength < 0) || (pathLength >= MAX_FILEPATH_LENGTH))
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "FILEIO: Path longer than %d characters (%s...)", MAX_FILEPATH_LENGTH, basePath);
|
||||
}
|
||||
@ -3746,12 +3746,12 @@ static void ScanDirectoryFilesRecursively(const char *basePath, FilePathList *fi
|
||||
{
|
||||
// Construct new path from our base path
|
||||
#if defined(_WIN32)
|
||||
int realPathLength = snprintf(path, sizeof(path) - 1, "%s\\%s", basePath, dp->d_name);
|
||||
int pathLength = snprintf(path, MAX_FILEPATH_LENGTH - 1, "%s\\%s", basePath, dp->d_name);
|
||||
#else
|
||||
int realPathLength = snprintf(path, sizeof(path) - 1, "%s/%s", basePath, dp->d_name);
|
||||
int pathLength = snprintf(path, MAX_FILEPATH_LENGTH - 1, "%s/%s", basePath, dp->d_name);
|
||||
#endif
|
||||
|
||||
if (realPathLength < 0 || realPathLength >= sizeof(path))
|
||||
if ((pathLength < 0) || (pathLength >= MAX_FILEPATH_LENGTH))
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "FILEIO: Path longer than %d characters (%s...)", MAX_FILEPATH_LENGTH, basePath);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user