Skip to content

Commit

Permalink
Catch access to paths that are just "." or ".." without any path sepa…
Browse files Browse the repository at this point in the history
…rator.

(transplanted from b6d25a1927c2274cf31166a74b87b24e2752e0e8)
  • Loading branch information
icculus committed Oct 26, 2017
1 parent a802619 commit 179bd1d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/physfs.c
Expand Up @@ -939,6 +939,10 @@ static int sanitizePlatformIndependentPath(const char *src, char *dst)
while (*src == '/') /* skip initial '/' chars... */
src++;

/* Make sure the entire string isn't "." or ".." */
if ((strcmp(src, ".") == 0) || (strcmp(src, "..") == 0))
BAIL(PHYSFS_ERR_BAD_FILENAME, 0);

prev = dst;
do
{
Expand Down

0 comments on commit 179bd1d

Please sign in to comment.