From 2e38fd78e5c9cbf64b76eecd8f426f3602035fe4 Mon Sep 17 00:00:00 2001 From: sezero Date: Sun, 2 Jan 2011 22:02:11 +0000 Subject: [PATCH] gl_model.c (Mod_LoadLighting): Check the path_id of the lit file and accept only if it is coming from the same game directory as for the map itself. git-svn-id: svn+ssh://svn.code.sf.net/p/quakespasm/code/trunk@372 af15c1b1-3010-417e-b628-4374ebc0bcbd --- quakespasm/Quake/gl_model.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/quakespasm/Quake/gl_model.c b/quakespasm/Quake/gl_model.c index 411acf87..9c1b3b0c 100644 --- a/quakespasm/Quake/gl_model.c +++ b/quakespasm/Quake/gl_model.c @@ -634,15 +634,24 @@ void Mod_LoadLighting (lump_t *l) byte *in, *out, *data; byte d; char litfilename[1024]; + unsigned int path_id; + loadmodel->lightdata = NULL; // LordHavoc: check for a .lit file strcpy(litfilename, loadmodel->name); COM_StripExtension(litfilename, litfilename); strcat(litfilename, ".lit"); mark = Hunk_LowMark(); - data = (byte*) COM_LoadHunkFile (litfilename, NULL); + data = (byte*) COM_LoadHunkFile (litfilename, &path_id); if (data) { + // use lit file only from the same gamedir as the map itself + if (path_id != loadmodel->path_id) + { + Hunk_FreeToLowMark(mark); + Con_DPrintf("%s ignored (not from the same gamedir)\n", litfilename); + } + else if (data[0] == 'Q' && data[1] == 'L' && data[2] == 'I' && data[3] == 'T') { i = LittleLong(((int *)data)[1]);