Skip to content

Commit aad59ad

Browse files
Merge pull request #194 from MaffooBristol/bug/only-top-files
Only allow .top and .tbl files from RAWDATA
2 parents 5cdeb00 + 0e2a258 commit aad59ad

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

SRC/scriptCompile.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4827,10 +4827,12 @@ static void ReadTopicFile(char* name,uint64 buildid) // read contents of a top
48274827
chunking = false;
48284828
unsigned int build = (unsigned int) buildid;
48294829
size_t len = strlen(name);
4830-
if (len > 1 && name[len-1] == '~') return; // unix backup editor file
4831-
if (len > 4 && !stricmp(name+len-4,(char*)".bak")) return; // windows backup file
48324830

4833-
if (name[len-1] == '~') return; // ignore linux edit backup files
4831+
// Check the filename is at least four characters (the ext plus one letter)
4832+
// and matches either .top or .tbl
4833+
char* suffix = name + len - 4;
4834+
if (len <= 4) return;
4835+
if (0 != stricmp(suffix, (char*) ".top") && 0 != stricmp(suffix, (char*) ".tbl")) return;
48344836

48354837
FILE* in = FopenReadNormal(name);
48364838
if (!in)

0 commit comments

Comments
 (0)