]> granicus.if.org Git - php/commitdiff
- Use IS_ABSOLUTE_PATH() so that this will work correctly under Windows
authorAndi Gutmans <andi@php.net>
Thu, 14 Sep 2000 20:47:35 +0000 (20:47 +0000)
committerAndi Gutmans <andi@php.net>
Thu, 14 Sep 2000 20:47:35 +0000 (20:47 +0000)
main/fopen_wrappers.c

index eae53f70024223e94bf7511297c8ce1b6d7e9a2a..e09e157c88f8a265c1720fe90f214ced395522e3 100644 (file)
@@ -390,6 +390,7 @@ PHPAPI FILE *php_fopen_with_path(char *filename, char *mode, char *path, char **
        char trypath[MAXPATHLEN + 1];
        struct stat sb;
        FILE *fp;
+       int filename_length;
        PLS_FETCH();
 
        if (opened_path) {
@@ -403,12 +404,10 @@ PHPAPI FILE *php_fopen_with_path(char *filename, char *mode, char *path, char **
                }
                return php_fopen_and_set_opened_path(filename, mode, opened_path);
        }
+
+       filename_length = strlen(filename);
        /* Absolute path open - prepend document_root in safe mode */
-#ifdef PHP_WIN32
-       if (IS_SLASH(*filename) || (filename[1] == ':')) {
-#else
-       if (IS_SLASH(*filename)) {
-#endif
+       if (IS_ABSOLUTE_PATH(filename, filename_length)) {
                if (PG(safe_mode) && PG(doc_root)) {
                        snprintf(trypath, MAXPATHLEN, "%s%s", PG(doc_root), filename);
                        if (!php_checkuid(trypath, mode, 0)) {