mirror of
https://github.com/yquake2/xatrix.git
synced 2024-11-10 06:42:22 +00:00
Add missing sanity checks in ED_ParseEdict() and ED_NewString().
This was reported by maraakate in yquake2 issue #160.
This commit is contained in:
parent
8a9b33612a
commit
48a06ef31e
1 changed files with 10 additions and 0 deletions
|
@ -341,6 +341,11 @@ ED_NewString(const char *string)
|
||||||
char *newb, *new_p;
|
char *newb, *new_p;
|
||||||
int i, l;
|
int i, l;
|
||||||
|
|
||||||
|
if (!string)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
l = strlen(string) + 1;
|
l = strlen(string) + 1;
|
||||||
|
|
||||||
newb = gi.TagMalloc(l, TAG_LEVEL);
|
newb = gi.TagMalloc(l, TAG_LEVEL);
|
||||||
|
@ -450,6 +455,11 @@ ED_ParseEdict(char *data, edict_t *ent)
|
||||||
char keyname[256];
|
char keyname[256];
|
||||||
const char *com_token;
|
const char *com_token;
|
||||||
|
|
||||||
|
if (!ent)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
init = false;
|
init = false;
|
||||||
memset(&st, 0, sizeof(st));
|
memset(&st, 0, sizeof(st));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue