- fix url check in open_basedir check
authorMichael Wallner <mike@php.net>
Thu, 15 Dec 2005 19:04:00 +0000 (19:04 +0000)
committerMichael Wallner <mike@php.net>
Thu, 15 Dec 2005 19:04:00 +0000 (19:04 +0000)
php_http_api.h

index 694ddc015de9fdfb1b26c8f1bcf1312e51c2f337..9f8eda9537900929c8313eb28fc7b8e45a97a966 100644 (file)
@@ -89,12 +89,12 @@ extern void _http_error_ex(long type TSRMLS_DC, long code, const char *format, .
  \
                if (!strncasecmp(tmp, "file:", lenof("file:"))) { \
                        tmp += lenof("file:"); \
-                       while (*tmp == '/' || *tmp == '\\') ++tmp; \
+                       while ((tmp - (const char *)file < 7) && (*tmp == '/' || *tmp == '\\')) ++tmp; \
                } \
  \
-               if (!*tmp || php_check_open_basedir(tmp TSRMLS_CC) || \
-                               (PG(safe_mode) && !php_checkuid(tmp, "rb+", CHECKUID_CHECK_MODE_PARAM))) { \
-                               http_error_ex(HE_WARNING, HTTP_E_INVALID_PARAM, "Permission denied: %s", file); \
+               if (    (tmp != file || !strstr(file, "://")) && \
+                               (!*tmp || php_check_open_basedir(tmp TSRMLS_CC) || \
+                               (PG(safe_mode) && !php_checkuid(tmp, "rb+", CHECKUID_CHECK_MODE_PARAM)))) { \
                                act; \
                } \
        }