#37779 [NEW]: _php_stream_fopen_with_path searches for files in /
| From: | jr at terragate dot net | Date: | Sun, 11 Jun 2006 10:35:00 +0000 |
| Subject: | #37779 [NEW]: _php_stream_fopen_with_path searches for files in / | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-98275@lists.php.net to get a copy of this message | ||
From: jr at terragate dot net
Operating system: Mac OS X (10.4)
PHP version: 5.1.5CVS
PHP Bug Type: Streams related
Bug description: _php_stream_fopen_with_path searches for files in /
Description:
------------
_php_stream_fopen_with_path will try to open files relative
to / if the given file does not exist in the current working
directory.
Fix:
http://jr.terragate.net/Public/php/
_php_stream_fopen_with_path.diff
Index: main/streams/plain_wrapper.c
============================================================
=======
RCS file: /repository/php-src/main/streams/plain_wrapper.c,v
retrieving revision 1.52.2.6
diff -u -u -r1.52.2.6 plain_wrapper.c
--- main/streams/plain_wrapper.c 17 Jan 2006 02:32:09
-0000 1.52.2.6
+++ main/streams/plain_wrapper.c 11 Jun 2006 10:01:11
-0000
@@ -1316,6 +1316,10 @@
*end = '\0';
end++;
}
+ if (*ptr == '\0') {
+ ptr = end;
+ continue;
+ }
snprintf(trypath, MAXPATHLEN, "%s/%s", ptr,
filename);
if (((options & STREAM_DISABLE_OPEN_BASEDIR)
== 0) && php_check_
open_basedir_ex(trypath, 0 TSRMLS_CC)) {
Reproduce code:
---------------
<?php
include 'etc/hosts';
?>
Expected result:
----------------
Warning: include(etc/hosts): failed to open stream: No such
file or directory in ...
Expected existence checks (include_path=.:):
cwd/etc/hosts
script_execution_path/etc/hosts
Actual result:
--------------
Output of /etc/hosts
Actual existence checks (include_path=.:):
cwd/etc/hosts
/etc/hosts
script_execution_path/etc/hosts
--
Edit bug report at http://bugs.php.net/?id=37779&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=37779&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=37779&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=37779&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=37779&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=37779&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=37779&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=37779&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=37779&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=37779&r=support
Expected behavior: http://bugs.php.net/fix.php?id=37779&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=37779&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=37779&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=37779&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=37779&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=37779&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=37779&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=37779&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=37779&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=37779&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=37779&r=mysqlcfg