Re: cvs: php-src /ext/standard dir.c /ext/standard/tests/file bug41655_1.phpt

From: Date: Mon, 25 Jun 2007 08:51:31 +0000
Subject: Re: cvs: php-src /ext/standard dir.c /ext/standard/tests/file bug41655_1.phpt
References: 1  Groups: php.cvs 
Request: Send a blank email to php-cvs+get-44932@lists.php.net to get a copy of this message
Hi Dmitry, On 6/25/07, Dmitry Stogov <dmitry@php.net> wrote:
dmitry          Mon Jun 25 08:40:37 2007 UTC
Modified files:
    /php-src/ext/standard       dir.c
    /php-src/ext/standard/tests/file    bug41655_1.phpt
Log: Better fix for bug #41655 http://cvs.php.net/viewvc.cgi/php-src/ext/standard/dir.c?r1=1.163&r2=1.164&diff_format=u Index: php-src/ext/standard/dir.c diff -u php-src/ext/standard/dir.c:1.163 php-src/ext/standard/dir.c:1.164
--- php-src/ext/standard/dir.c:1.163    Tue Jun 12 13:42:04 2007
+++ php-src/ext/standard/dir.c Mon Jun 25 08:40:36 2007 @@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
*/ -/* $Id: dir.c,v 1.163 2007/06/12 13:42:04 scottmac Exp $ */ +/* $Id: dir.c,v 1.164 2007/06/25 08:40:36 dmitry Exp $ */ /* {{{ includes/startup/misc */ @@ -423,16 +423,15 @@ #endif
        if (PG(open_basedir) && *PG(open_basedir)) {
-               size_t base_len = php_dirname(pattern, strlen(pattern));
-               char pos = pattern[base_len];
-
-               pattern[base_len] = '\0';
-
+               int pattern_len = strlen(pattern);
+               char *basename = estrndup(pattern, pattern_len);
+
+               php_dirname(basename, pattern_len);
Why is it a better fix? In these versions (head and 5.2), we don't need to duplicate the pattern. I applied in 4.4 as dirname modifies the pattern. Cheers, --Pierre

« previous php.cvs (#44932) next »