Fix directory crash for filenames that appear elsewhere in the path

This commit is contained in:
Magnus Norddahl 2024-07-12 19:50:18 +02:00 committed by Rachael Alexanderson
parent 0caa036a96
commit 9d78eb5aa0
No known key found for this signature in database
GPG key ID: 26A8ACCE97115EE0

View file

@ -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());
}