php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login

Patch themostevilpatchever2.patch for Filesystem function related Bug #60704

Patch version 2012-02-12 09:53 UTC

Return to Bug #60704 | Download this patch
Patch Revisions:

Developer: shm@php.net

Index: main/streams/plain_wrapper.c
===================================================================
--- main/streams/plain_wrapper.c	(wersja 323163)
+++ main/streams/plain_wrapper.c	(kopia robocza)
@@ -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 Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 11:01:29 2024 UTC