Add missing sanity checks in ED_ParseEdict() and ED_NewString().

This was reported by maraakate in yquake2 issue #160.
This commit is contained in:
Yamagi Burmeister 2016-12-17 10:55:38 +01:00
parent 8a9b33612a
commit 48a06ef31e
1 changed files with 10 additions and 0 deletions

View File

@ -341,6 +341,11 @@ ED_NewString(const char *string)
char *newb, *new_p;
int i, l;
if (!string)
{
return NULL;
}
l = strlen(string) + 1;
newb = gi.TagMalloc(l, TAG_LEVEL);
@ -450,6 +455,11 @@ ED_ParseEdict(char *data, edict_t *ent)
char keyname[256];
const char *com_token;
if (!ent)
{
return NULL;
}
init = false;
memset(&st, 0, sizeof(st));