From d354b52b1107025b4fd538bd2fc56bb48895e307 Mon Sep 17 00:00:00 2001 From: Diordany van Hemert Date: Mon, 25 Dec 2023 01:02:50 +0100 Subject: [PATCH] Check if the requested game exists Co-authored-by: Ozkan Sezer --- Quake/common.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Quake/common.c b/Quake/common.c index 5e32afa6b..87f3e481e 100644 --- a/Quake/common.c +++ b/Quake/common.c @@ -2189,6 +2189,15 @@ static void COM_Game_f (void) } } + if (Sys_FileType(va("%s/%s", com_basedir, p)) != FS_ENT_DIRECTORY) + { + if (host_parms->userdir == host_parms->basedir || (Sys_FileType(va("%s/%s", host_parms->userdir, p)) != FS_ENT_DIRECTORY)) + { + Con_Printf ("No such game directory \"%s\"\n", p); + return; + } + } + if (!q_strcasecmp(p, COM_SkipPath(com_gamedir))) //no change { if (com_searchpaths->path_id > 1) { //current game not id1