summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorNuno Lopes <nlopess@php.net>2006-09-16 17:41:57 +0000
committerNuno Lopes <nlopess@php.net>2006-09-16 17:41:57 +0000
commitbfc9cd7174155368c11e94f45c6e32e0e7ddb677 (patch)
treeca7b09ff2598bbbf21c21112ea0963922d6d8e8d /ext
parent868b219a289bd47cfe7df416fa218bfa08981272 (diff)
downloadphp-git-bfc9cd7174155368c11e94f45c6e32e0e7ddb677.tar.gz
fix possible crash in posix_access()
Diffstat (limited to 'ext')
-rw-r--r--ext/posix/posix.c4
-rw-r--r--ext/posix/tests/001.phpt12
2 files changed, 16 insertions, 0 deletions
diff --git a/ext/posix/posix.c b/ext/posix/posix.c
index 418f1f1a6b..4d1d0be371 100644
--- a/ext/posix/posix.c
+++ b/ext/posix/posix.c
@@ -771,6 +771,10 @@ PHP_FUNCTION(posix_access)
}
path = expand_filepath(filename, NULL TSRMLS_CC);
+ if (!path) {
+ POSIX_G(last_error) = EIO;
+ RETURN_FALSE;
+ }
if (php_check_open_basedir_ex(path, 0 TSRMLS_CC) ||
(PG(safe_mode) && (!php_checkuid_ex(filename, NULL, CHECKUID_CHECK_FILE_AND_DIR, CHECKUID_NO_ERRORS)))) {
diff --git a/ext/posix/tests/001.phpt b/ext/posix/tests/001.phpt
new file mode 100644
index 0000000000..e6c629ce63
--- /dev/null
+++ b/ext/posix/tests/001.phpt
@@ -0,0 +1,12 @@
+--TEST--
+posix_access() with bogus paths
+--SKIPIF--
+<?php if (!extension_loaded('posix')) echo 'skip'; ?>
+--FILE--
+<?php
+
+var_dump(posix_access(str_repeat('bogus path', 1042)));
+
+?>
+--EXPECT--
+bool(false)