shm Tue, 14 Feb 2012 14:14:30 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=323213
Log: * fixed bug #60704 unlink() bug with some files path Reviewed by: rasmus@ Bug: https://bugs.php.net/60704 (Assigned) unlink() bug with some files path Changed paths: U php/php-src/branches/PHP_5_3/main/streams/plain_wrapper.c U php/php-src/trunk/main/streams/plain_wrapper.c Modified: php/php-src/branches/PHP_5_3/main/streams/plain_wrapper.c =================================================================== --- php/php-src/branches/PHP_5_3/main/streams/plain_wrapper.c 2012-02-14 13:31:23 UTC (rev 323212) +++ php/php-src/branches/PHP_5_3/main/streams/plain_wrapper.c 2012-02-14 14:14:30 UTC (rev 323213) @@ -1010,9 +1010,12 @@ static int php_plain_files_url_stater(php_stream_wrapper *wrapper, char *url, int flags, php_stream_statbuf *ssb, php_stream_context *context TSRMLS_DC) { + char *p; - if (strncmp(url, "file://", sizeof("file://") - 1) == 0) { - url += sizeof("file://") - 1; + if ((p = strstr(url, "://")) != NULL) { + if (p < strchr(url, '/')) { + url = p + 3; + } } if (PG(safe_mode) &&(!php_checkuid_ex(url, NULL, CHECKUID_CHECK_FILE_AND_DIR, (flags & PHP_STREAM_URL_STAT_QUIET) ? CHECKUID_NO_ERRORS : 0))) { @@ -1045,7 +1048,9 @@ int ret; if ((p = strstr(url, "://")) != NULL) { - url = p + 3; + if (p < strchr(url, '/')) { + url = p + 3; + } } if (options & ENFORCE_SAFE_MODE) { @@ -1093,11 +1098,15 @@ #endif if ((p = strstr(url_from, "://")) != NULL) { - url_from = p + 3; + if (p < strchr(url_from, '/')) { + url_from = p + 3; + } } if ((p = strstr(url_to, "://")) != NULL) { - url_to = p + 3; + if (p < strchr(url_to, '/')) { + url_to = p + 3; + } } if (PG(safe_mode) && (!php_checkuid(url_from, NULL, CHECKUID_CHECK_FILE_AND_DIR) || @@ -1168,7 +1177,9 @@ char *p; if ((p = strstr(dir, "://")) != NULL) { - dir = p + 3; + if (p < strchr(dir, '/')) { + dir = p + 3; + } } if (!recursive) { Modified: php/php-src/trunk/main/streams/plain_wrapper.c =================================================================== --- php/php-src/trunk/main/streams/plain_wrapper.c 2012-02-14 13:31:23 UTC (rev 323212) +++ php/php-src/trunk/main/streams/plain_wrapper.c 2012-02-14 14:14:30 UTC (rev 323213) @@ -1001,9 +1001,12 @@ static int php_plain_files_url_stater(php_stream_wrapper *wrapper, char *url, int flags, php_stream_statbuf *ssb, php_stream_context *context TSRMLS_DC) { + char *p; - if (strncmp(url, "file://", sizeof("file://") - 1) == 0) { - url += sizeof("file://") - 1; + if ((p = strstr(url, "://")) != NULL) { + if (p < strchr(url, '/')) { + url = p + 3; + } } if (php_check_open_basedir_ex(url, (flags & PHP_STREAM_URL_STAT_QUIET) ? 0 : 1 TSRMLS_CC)) { @@ -1032,7 +1035,9 @@ int ret; if ((p = strstr(url, "://")) != NULL) { - url = p + 3; + if (p < strchr(url, '/')) { + url = p + 3; + } } if (php_check_open_basedir(url TSRMLS_CC)) { @@ -1074,11 +1079,15 @@ #endif if ((p = strstr(url_from, "://")) != NULL) { - url_from = p + 3; + if (p < strchr(url_from, '/')) { + url_from = p + 3; + } } if ((p = strstr(url_to, "://")) != NULL) { - url_to = p + 3; + if (p < strchr(url_to, '/')) { + url_to = p + 3; + } } if (php_check_open_basedir(url_from TSRMLS_CC) || php_check_open_basedir(url_to TSRMLS_CC)) { @@ -1144,7 +1153,9 @@ char *p; if ((p = strstr(dir, "://")) != NULL) { - dir = p + 3; + if (p < strchr(dir, '/')) { + dir = p + 3; + } } if (!recursive) { @@ -1273,7 +1284,9 @@ #endif if ((p = strstr(url, "://")) != NULL) { - url = p + 3; + if (p < strchr(url, '/')) { + url = p + 3; + } } if (php_check_open_basedir(url TSRMLS_CC)) {
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php