Add missing sanity checks to ED_ParseEdict() and ED_NewString()

This was reported by maraakate in issue #160.
This commit is contained in:
Yamagi Burmeister 2016-12-17 11:24:40 +01:00
parent 971bca9914
commit 52fd07eb33

View file

@ -327,6 +327,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);
@ -436,6 +441,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));