From: divverent Date: Wed, 11 Apr 2012 10:58:16 +0000 (+0000) Subject: fix "strings go past end of file" check X-Git-Tag: xonotic-v0.8.0~96^2~247 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=65d7926b2422eda155a0c4ae4a313e882f922c7e;p=xonotic%2Fdarkplaces.git fix "strings go past end of file" check git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11791 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/prvm_edict.c b/prvm_edict.c index ddda4e99..4d20f1c1 100644 --- a/prvm_edict.c +++ b/prvm_edict.c @@ -1949,7 +1949,7 @@ void PRVM_Prog_Load(prvm_prog_t *prog, const char * filename, int numrequiredfun prog->numglobals = prog->progs_numglobals; prog->entityfields = prog->progs_entityfields; - if (LittleLong(dprograms->ofs_strings) + prog->progs_numstrings >= (int)filesize) + if (LittleLong(dprograms->ofs_strings) + prog->progs_numstrings > (int)filesize) prog->error_cmd("%s: %s strings go past end of file", prog->name, filename); prog->strings = (char *)Mem_Alloc(prog->progs_mempool, prog->progs_numstrings); memcpy(prog->strings, instrings, prog->progs_numstrings);