From 1fddd1859e6b6aca3e7e8cb603f798a8329385f1 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 5 Apr 2015 00:38:29 +0200 Subject: [PATCH] - fixed: FResourceFile::FilterLumps must use a proper copy of the filename to pass to LumpNameSetup instead of a pointer to the file name's stringbuffer, because that function will overwrite the variable it is taken from. --- src/resourcefiles/resourcefile.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/resourcefiles/resourcefile.cpp b/src/resourcefiles/resourcefile.cpp index ebeb40d96..b4280adf6 100644 --- a/src/resourcefiles/resourcefile.cpp +++ b/src/resourcefiles/resourcefile.cpp @@ -98,8 +98,7 @@ void FResourceLump::LumpNameSetup(const char *iname) base = base.Left(base.LastIndexOf('.')); uppercopy(Name, base); Name[8] = 0; - FString temp = iname; // Note: iname can point to inside FullName's string buffer so we cannot do the assignment directly. - FullName = temp; + FullName = iname; // Map some directories to WAD namespaces. // Note that some of these namespaces don't exist in WADS. @@ -382,7 +381,7 @@ int FResourceFile::FilterLumps(FString filtername, void *lumps, size_t lumpsize, { FResourceLump *lump = (FResourceLump *)lump_p; assert(lump->FullName.CompareNoCase(filter, (int)filter.Len()) == 0); - lump->LumpNameSetup(&lump->FullName[filter.Len()]); + lump->LumpNameSetup(lump->FullName.Mid(filter.Len())); } // Move filtered lumps to the end of the lump list.