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

Patch open_basedir-trailing-slash-fix-PHP_5_3 for Safe Mode/open_basedir Bug #53577

Patch version 2010-12-20 16:36 UTC

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

Developer: lekensteyn@gmail.com

*** fopen_wrappers.c.orig	Mon Dec 20 16:53:43 2010
--- fopen_wrappers.c	Mon Dec 20 17:27:43 2010
***************
*** 229,235 ****
--- 229,239 ----
  	if (expand_filepath(local_open_basedir, resolved_basedir TSRMLS_CC) != NULL) {
  		/* Handler for basedirs that end with a / */
  		resolved_basedir_len = strlen(resolved_basedir);
+ #if defined(PHP_WIN32) || defined(NETWARE)
+ 		if (basedir[strlen(basedir) - 1] == PHP_DIR_SEPARATOR || basedir[strlen(basedir) - 1] == '/') {
+ #else
  		if (basedir[strlen(basedir) - 1] == PHP_DIR_SEPARATOR) {
+ #endif
  			if (resolved_basedir[resolved_basedir_len - 1] != PHP_DIR_SEPARATOR) {
  				resolved_basedir[resolved_basedir_len] = PHP_DIR_SEPARATOR;
  				resolved_basedir[++resolved_basedir_len] = '\0';
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 16:01:29 2024 UTC