Req #39863 [Com]: file_exists() silently truncates after a null byte
| From: | patrick at cookie dot monster dot org | Date: | Wed, 19 Jan 2011 12:13:54 +0000 |
| Subject: | Req #39863 [Com]: file_exists() silently truncates after a null byte | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-158001@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=39863&edit=1
ID: 39863
Comment by: patrick at cookie dot monster dot org
Reported by: djcapelis at gmail dot com
Summary: file_exists() silently truncates after a null byte
Status: Assigned
Type: Feature/Change Request
Package: *General Issues
Operating System: Linux, MacOSX
PHP Version: 4.4.4, 5.1.5
Assigned To: pajoye
Block user comment: N
Private report: N
CVE-ID: 2006-7243
New Comment:
Will this be fixed too in php 5.2.17?
Previous Comments:
------------------------------------------------------------------------
[2010-11-18 17:21:15] pajoye@php.net
Fixed in PHP_5_3, will be part of 5.3.4.
trunk still needs the fix, it will be done soonish.
------------------------------------------------------------------------
[2010-11-18 16:22:24] pajoye@php.net
Automatic comment from SVN on behalf of pajoye
Revision: http://svn.php.net/viewvc/?view=revision&revision=305507
Log: - fix #39863, do not accept paths with NULL in them. See
http://news.php.net/php.internals/50191,
trunk will have the patch later
(adding a macro and/or changing (some) APIs. Patch by Rasmus
------------------------------------------------------------------------
[2010-06-05 21:45:27] sixd@php.net
I've merged the test as ext/standard/tests/file/bug39863.phpt
------------------------------------------------------------------------
[2010-06-05 21:44:50] sixd@php.net
Automatic comment from SVN on behalf of sixd
Revision: http://svn.php.net/viewvc/?view=revision&revision=300213
Log: New test for file_exists (bug #39863). It currently xfail's
------------------------------------------------------------------------
[2010-05-12 13:25:42] vanderaj at owasp dot org
I've tested this on CentOS 5.0 with a hand built 5.2.11 and Apple's
build of PHP
5.3.1 on MacOS X 10.6.3, and both have this issue.
If you don't want to run a phpt, here's some a more readable version of
the
previous test:
<?php
$filename = "/etc/passwd" . chr(0). ".ridiculous";
if (file_exists($filename))
{
echo "FAIL: The file [" . $filename . "] exists, but clearly
shouldn't.\n";
}
else
{
echo "PASS: The file [" . $filename . "] does not exist.\n";
}
?>
I've included a PHP test script. It's my first phpt, so please be
gentle.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/bug.php?id=39863
--
Edit this bug report at http://bugs.php.net/bug.php?id=39863&edit=1