From: divverent Date: Sat, 7 Feb 2015 21:14:36 +0000 (+0000) Subject: Detect negative name size in pk3s. X-Git-Tag: xonotic-v0.8.1~29^2~9 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=7e026612d4326f751e2a80a5c73ce882a6b93ecc;p=xonotic%2Fdarkplaces.git Detect negative name size in pk3s. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12151 d7cf8633-e32d-0410-b094-e92efae38249 --- 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;