summaryrefslogtreecommitdiff
path: root/main/streams.c
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2002-10-20 20:44:10 +0000
committerIlia Alshanetsky <iliaa@php.net>2002-10-20 20:44:10 +0000
commitfef922307cbf3ed1be28fa47ecb2d43ed94f8714 (patch)
treee9dee021ece6adec86744c9f3cdea14192f0a9cc /main/streams.c
parentc33a695f85d1fce4eaab68eb859c758d3d73df5d (diff)
downloadphp-git-fef922307cbf3ed1be28fa47ecb2d43ed94f8714.tar.gz
Fixed incorrect handling of files starting with a .
Diffstat (limited to 'main/streams.c')
-rwxr-xr-xmain/streams.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/main/streams.c b/main/streams.c
index e820e53d18..e7e576f155 100755
--- a/main/streams.c
+++ b/main/streams.c
@@ -1518,7 +1518,16 @@ PHPAPI php_stream *_php_stream_fopen_with_path(char *filename, char *mode, char
filename_length = strlen(filename);
/* Relative path open */
- if (*filename == '.') {
+ if (*filename == '.' && (*(filename+1) == '/' || *(filename+1) == '.')) {
+ /* further checks, we could have ....... filenames */
+ ptr = filename + 1;
+ if (ptr == '.') {
+ while (*(++ptr) == '.');
+ if (ptr != '/') { /* not a relative path after all */
+ goto not_relative_path;
+ }
+ }
+
if (php_check_open_basedir(filename TSRMLS_CC)) {
return NULL;
@@ -1535,6 +1544,8 @@ PHPAPI php_stream *_php_stream_fopen_with_path(char *filename, char *mode, char
* safe mode GID/UID checks
*/
+ not_relative_path:
+
/* Absolute path open */
if (IS_ABSOLUTE_PATH(filename, filename_length)) {