Skip to content

Commit

Permalink
Fix reading of model defs that begin with "PLAYER"
Browse files Browse the repository at this point in the history
  • Loading branch information
Lactozilla committed Sep 10, 2023
1 parent 74bd77b commit 312dc02
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/hardware/hw_md2.c
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,8 @@ static void ReadModelDefs(char *data, size_t size)
char *line = NULL;

size_t l = TextReader_GetLineLength(r);
size_t prefix_len = strlen(PLAYERMODELPREFIX);

while (l)
{
line = Z_Realloc(line, l, PU_STATIC, NULL);
Expand All @@ -461,9 +463,9 @@ static void ReadModelDefs(char *data, size_t size)
size_t len = strlen(name);

// Check for the player model prefix
if (len > sizeof(PLAYERMODELPREFIX) && !strnicmp(name, PLAYERMODELPREFIX, sizeof(PLAYERMODELPREFIX)))
if (len > prefix_len && !strncasecmp(name, PLAYERMODELPREFIX, prefix_len))
{
skinname += sizeof(PLAYERMODELPREFIX);
skinname += prefix_len;
goto addskinmodel;
}

Expand Down

0 comments on commit 312dc02

Please sign in to comment.