Fix potential index out of bounds

This commit is contained in:
Johan Mattsson 2023-03-04 22:03:17 +01:00 committed by GitHub
parent 11a9edd263
commit 2efd5f0acd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -490,8 +490,8 @@ DefineEngineFunction(getDirectoryList, String, ( const char* path, S32 depth ),
if (fullpath[dStrlen(fullpath) - 1] != '/') if (fullpath[dStrlen(fullpath) - 1] != '/')
{ {
S32 pos = dStrlen(fullpath); S32 pos = dStrlen(fullpath);
fullpath[pos] = '/'; fullpath[pos - 1] = '/';
fullpath[pos + 1] = '\0'; fullpath[pos] = '\0';
} }
// Dump the directories. // Dump the directories.