From f5ab26a45b42c33e3b8f89a81a0e43d6e589b55c Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Fri, 12 Jul 2024 19:50:18 +0200 Subject: [PATCH] Fix directory crash for filenames that appear elsewhere in the path --- src/common/filesystem/source/file_directory.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/filesystem/source/file_directory.cpp b/src/common/filesystem/source/file_directory.cpp index 3193e00b1..1999e9c4c 100644 --- a/src/common/filesystem/source/file_directory.cpp +++ b/src/common/filesystem/source/file_directory.cpp @@ -106,7 +106,7 @@ int FDirectory::AddDirectory(const char *dirpath, LumpFilterInfo* filter, FileSy if (mBasePath == nullptr) { // extract the base path from the first entry to cover changes made in ScanDirectory. - auto full = entry.FilePath.find(entry.FilePathRel); + auto full = entry.FilePath.rfind(entry.FilePathRel); std::string path(entry.FilePath, 0, full); mBasePath = stringpool->Strdup(path.c_str()); }