]> granicus.if.org Git - php/commitdiff
Fixed incorrect handling of files starting with a .
authorIlia Alshanetsky <iliaa@php.net>
Sun, 20 Oct 2002 20:44:10 +0000 (20:44 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Sun, 20 Oct 2002 20:44:10 +0000 (20:44 +0000)
main/streams.c

index e820e53d18a19011e7f67895fb78a77d610b3c24..e7e576f155ba43108bb80f720a73409f7ee8e318 100755 (executable)
@@ -1518,7 +1518,16 @@ PHPAPI php_stream *_php_stream_fopen_with_path(char *filename, char *mode, char
        filename_length = strlen(filename);
 
        /* Relative path open */
-       if (*filename == '.') {
+       if (*filename == '.' && (*(filename+1) == '/' || *(filename+1) == '.')) {
+               /* further checks, we could have ....... filenames */
+               ptr = filename + 1;
+               if (ptr == '.') {
+                       while (*(++ptr) == '.');
+                       if (ptr != '/') { /* not a relative path after all */
+                               goto not_relative_path;
+                       }
+               }
+
 
                if (php_check_open_basedir(filename TSRMLS_CC)) {
                        return NULL;
@@ -1535,6 +1544,8 @@ PHPAPI php_stream *_php_stream_fopen_with_path(char *filename, char *mode, char
         * safe mode GID/UID checks
         */
 
+       not_relative_path:
+
        /* Absolute path open */
        if (IS_ABSOLUTE_PATH(filename, filename_length)) {