瀏覽代碼

Fix potential index out of bounds

Johan Mattsson 2 年之前
父節點
當前提交
2efd5f0acd
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      Engine/source/console/fileSystemFunctions.cpp

+ 2 - 2
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.