From 2efd5f0acd3c4b0286abaf1f95e7a7ceaae0631e Mon Sep 17 00:00:00 2001 From: Johan Mattsson <39247600+mjunix@users.noreply.github.com> Date: Sat, 4 Mar 2023 22:03:17 +0100 Subject: [PATCH] Fix potential index out of bounds --- Engine/source/console/fileSystemFunctions.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Engine/source/console/fileSystemFunctions.cpp b/Engine/source/console/fileSystemFunctions.cpp index a9e2f47e6..b6fb119ba 100644 --- a/Engine/source/console/fileSystemFunctions.cpp +++ b/Engine/source/console/fileSystemFunctions.cpp @@ -490,8 +490,8 @@ DefineEngineFunction(getDirectoryList, String, ( const char* path, S32 depth ), if (fullpath[dStrlen(fullpath) - 1] != '/') { S32 pos = dStrlen(fullpath); - fullpath[pos] = '/'; - fullpath[pos + 1] = '\0'; + fullpath[pos - 1] = '/'; + fullpath[pos] = '\0'; } // Dump the directories.