From cbfb24ef3360fa37d4c0dd1dd0a80872cdefac66 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Sat, 6 Feb 2016 17:47:55 -0600 Subject: [PATCH] Disable -file "" - This isn't a real file or even a name, but the game would try and load it, including running through various permutations, potentially resulting in loading the current directory as an archive. --- src/d_main.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/d_main.cpp b/src/d_main.cpp index fddb2c86a..054e597fa 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -1476,7 +1476,7 @@ void ParseCVarInfo() bool D_AddFile (TArray &wadfiles, const char *file, bool check, int position) { - if (file == NULL) + if (file == NULL || *file == '\0') { return false; } @@ -1507,6 +1507,10 @@ bool D_AddFile (TArray &wadfiles, const char *file, bool check, int pos void D_AddWildFile (TArray &wadfiles, const char *value) { + if (value == NULL || *value == '\0') + { + return; + } const char *wadfile = BaseFileSearch (value, ".wad"); if (wadfile != NULL) @@ -1648,6 +1652,10 @@ static const char *BaseFileSearch (const char *file, const char *ext, bool lookf { static char wad[PATH_MAX]; + if (file == NULL || *file == '\0') + { + return NULL; + } if (lookfirstinprogdir) { mysnprintf (wad, countof(wad), "%s%s%s", progdir.GetChars(), progdir[progdir.Len() - 1] != '/' ? "/" : "", file);