Merge branch 'dyn-alloc-action-name' into 'next'

Dynamically allocate space for a state's action field

See merge request STJr/SRB2!1478
This commit is contained in:
MascaraSnake 2022-12-31 09:35:15 +00:00
commit 193a592d46

View file

@ -2759,13 +2759,13 @@ void readframe(MYFILE *f, INT32 num)
{
size_t z;
boolean found = false;
char actiontocompare[32];
size_t actionlen = strlen(word2) + 1;
char *actiontocompare = calloc(actionlen, 1);
memset(actiontocompare, 0x00, sizeof(actiontocompare));
strlcpy(actiontocompare, word2, sizeof (actiontocompare));
strcpy(actiontocompare, word2);
strupr(actiontocompare);
for (z = 0; z < 32; z++)
for (z = 0; z < actionlen; z++)
{
if (actiontocompare[z] == '\n' || actiontocompare[z] == '\r')
{
@ -2798,6 +2798,8 @@ void readframe(MYFILE *f, INT32 num)
if (!found)
deh_warning("Unknown action %s", actiontocompare);
free(actiontocompare);
}
else
deh_warning("Frame %d: unknown word '%s'", num, word1);