From 7e026612d4326f751e2a80a5c73ce882a6b93ecc Mon Sep 17 00:00:00 2001 From: divverent Date: Sat, 7 Feb 2015 21:14:36 +0000 Subject: [PATCH] Detect negative name size in pk3s. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12151 d7cf8633-e32d-0410-b094-e92efae38249 --- fs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs.c b/fs.c index 8c8059ca..27381f07 100644 --- a/fs.c +++ b/fs.c @@ -668,7 +668,7 @@ static int PK3_BuildFileList (pack_t *pack, const pk3_endOfCentralDir_t *eocd) if ((ptr[8] & 0x21) == 0 && (ptr[38] & 0x18) == 0) { // Still enough bytes for the name? - if (remaining < namesize || namesize >= (int)sizeof (*pack->files)) + if (namesize < 0 || remaining < namesize || namesize >= (int)sizeof (*pack->files)) { Mem_Free (central_dir); return -1; -- 2.39.2