Skip to content

Commit

Permalink
ignorecase: Don't crash if enumeration returned a NULL pointer.
Browse files Browse the repository at this point in the history
(transplanted from f83d05e87212a5c7e377f3b205e6d70fc42772d4)
  • Loading branch information
icculus committed Mar 9, 2018
1 parent 89d4809 commit 0bad12d
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions extras/ignorecase.c
Expand Up @@ -50,18 +50,22 @@ static int locateOneElement(char *buf)
ptr++; /* point past dirsep to entry itself. */
} /* else */

for (i = rc; *i != NULL; i++)
if (rc != NULL)
{
if (PHYSFS_utf8stricmp(*i, ptr) == 0)
for (i = rc; *i != NULL; i++)
{
strcpy(ptr, *i); /* found a match. Overwrite with this case. */
PHYSFS_freeList(rc);
return 1;
} /* if */
} /* for */
if (PHYSFS_utf8stricmp(*i, ptr) == 0)
{
strcpy(ptr, *i); /* found a match. Overwrite with this case. */
PHYSFS_freeList(rc);
return 1;
} /* if */
} /* for */

PHYSFS_freeList(rc);
} /* if */

/* no match at all... */
PHYSFS_freeList(rc);
return 0;
} /* locateOneElement */

Expand Down

0 comments on commit 0bad12d

Please sign in to comment.