Przeglądaj źródła

Catch access to paths that are just "." or ".." without any path separator.

Ryan C. Gordon 8 lat temu
rodzic
commit
a45afc5d50
1 zmienionych plików z 4 dodań i 0 usunięć
  1. 4 0
      src/physfs.c

+ 4 - 0
src/physfs.c

@@ -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
     {