tighten a bit more..

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1012 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
Ozkan Sezer 2014-09-09 11:50:38 +00:00
parent 596628530b
commit 99fa5eb2a3

View file

@ -1954,7 +1954,7 @@ static void COM_Game_f (void)
return; return;
} }
if (!strcmp(p, ".") || strstr(p, "..") || strstr(p, "/") || strstr(p, "\\") || strstr(p, ":")) if (!*p || !strcmp(p, ".") || strstr(p, "..") || strstr(p, "/") || strstr(p, "\\") || strstr(p, ":"))
{ {
Con_Printf ("gamedir should be a single directory name, not a path\n"); Con_Printf ("gamedir should be a single directory name, not a path\n");
return; return;
@ -2090,11 +2090,9 @@ void COM_InitFilesystem (void) //johnfitz -- modified based on topaz's tutorial
q_strlcpy (com_basedir, host_parms->basedir, sizeof(com_basedir)); q_strlcpy (com_basedir, host_parms->basedir, sizeof(com_basedir));
j = strlen (com_basedir); j = strlen (com_basedir);
if (j > 0) if (j < 1) Sys_Error("Bad argument to -basedir");
{ if ((com_basedir[j-1] == '\\') || (com_basedir[j-1] == '/'))
if ((com_basedir[j-1] == '\\') || (com_basedir[j-1] == '/')) com_basedir[j-1] = 0;
com_basedir[j-1] = 0;
}
// start up with GAMENAME by default (id1) // start up with GAMENAME by default (id1)
COM_AddGameDirectory (com_basedir, GAMENAME); COM_AddGameDirectory (com_basedir, GAMENAME);
@ -2118,7 +2116,7 @@ void COM_InitFilesystem (void) //johnfitz -- modified based on topaz's tutorial
if (i && i < com_argc-1) if (i && i < com_argc-1)
{ {
const char *p = com_argv[i + 1]; const char *p = com_argv[i + 1];
if (!strcmp(p, ".") || strstr(p, "..") || strstr(p, "/") || strstr(p, "\\") || strstr(p, ":")) if (!*p || !strcmp(p, ".") || strstr(p, "..") || strstr(p, "/") || strstr(p, "\\") || strstr(p, ":"))
Sys_Error ("gamedir should be a single directory name, not a path\n"); Sys_Error ("gamedir should be a single directory name, not a path\n");
com_modified = true; com_modified = true;
// don't load mission packs twice // don't load mission packs twice