1
0
Fork 0
forked from fte/fteqw

Should fix the Nexuiz menu crash reported by TimeServ

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1457 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2005-10-09 21:59:54 +00:00
parent fc770f310d
commit 2fa6c2b103
2 changed files with 118 additions and 112 deletions

View file

@ -427,13 +427,13 @@ unsigned int *ED_FindGlobalOfsFromProgs (progfuncs_t *progfuncs, char *name, pro
ED_FindFunction ED_FindFunction
============ ============
*/ */
dfunction_t *ED_FindFunction (progfuncs_t *progfuncs, char *name, progsnum_t *prnum, unsigned int fromprogs) dfunction_t *ED_FindFunction (progfuncs_t *progfuncs, char *name, progsnum_t *prnum, progsnum_t fromprogs)
{ {
dfunction_t *func; dfunction_t *func;
unsigned int i; unsigned int i;
char *sep; char *sep;
int pnum; progsnum_t pnum;
if (prnum) if (prnum)
{ {
@ -455,6 +455,12 @@ dfunction_t *ED_FindFunction (progfuncs_t *progfuncs, char *name, progsnum_t *pr
else else
pnum = pr_typecurrent; pnum = pr_typecurrent;
if ((unsigned)pnum > (unsigned)maxprogs)
{
printf("Progsnum %i out of bounds\n", pnum);
return NULL;
}
if (!pr_progstate[pnum].progs) if (!pr_progstate[pnum].progs)
return NULL; return NULL;

View file

@ -426,7 +426,7 @@ ddef32_t *ED_FindTypeGlobalFromProgs32 (progfuncs_t *progfuncs, char *name, prog
ddef16_t *ED_FindGlobalFromProgs16 (progfuncs_t *progfuncs, char *name, progsnum_t prnum); ddef16_t *ED_FindGlobalFromProgs16 (progfuncs_t *progfuncs, char *name, progsnum_t prnum);
ddef32_t *ED_FindGlobalFromProgs32 (progfuncs_t *progfuncs, char *name, progsnum_t prnum); ddef32_t *ED_FindGlobalFromProgs32 (progfuncs_t *progfuncs, char *name, progsnum_t prnum);
fdef_t *ED_FindField (progfuncs_t *progfuncs, char *name); fdef_t *ED_FindField (progfuncs_t *progfuncs, char *name);
dfunction_t *ED_FindFunction (progfuncs_t *progfuncs, char *name, progsnum_t *pnum, unsigned int fromprogs); dfunction_t *ED_FindFunction (progfuncs_t *progfuncs, char *name, progsnum_t *pnum, progsnum_t fromprogs);
func_t PR_FindFunc(progfuncs_t *progfncs, char *funcname, progsnum_t pnum); func_t PR_FindFunc(progfuncs_t *progfncs, char *funcname, progsnum_t pnum);
void PR_Configure (progfuncs_t *progfncs, int addressable_size, int max_progs); void PR_Configure (progfuncs_t *progfncs, int addressable_size, int max_progs);
int PR_InitEnts(progfuncs_t *progfncs, int maxents); int PR_InitEnts(progfuncs_t *progfncs, int maxents);