summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Thompson <ab5602@php.net>2007-10-10 22:52:58 +0000
committerRobert Thompson <ab5602@php.net>2007-10-10 22:52:58 +0000
commit50250dff8c5e1e6d47b309dc904b180e42d54065 (patch)
tree3898e59baf6047cc76ea0a5a86e4f7baaa227f9b
parent0c6e83258486c00d25df445f87fb52f1e0f65f0c (diff)
downloadphp-git-50250dff8c5e1e6d47b309dc904b180e42d54065.tar.gz
Fix for bug 41899, safe mode and relative paths with Solaris's broken getcwd().
-rw-r--r--main/safe_mode.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/main/safe_mode.c b/main/safe_mode.c
index 0c1523e57c..f5e7f9e7e8 100644
--- a/main/safe_mode.c
+++ b/main/safe_mode.c
@@ -86,7 +86,15 @@ PHPAPI int php_checkuid_ex(const char *filename, const char *fopen_mode, int mod
* If that fails, passthrough and check directory...
*/
if (mode != CHECKUID_ALLOW_ONLY_DIR) {
- expand_filepath(filename, path TSRMLS_CC);
+
+ char ftest[MAXPATHLEN];
+ strcpy(ftest,filename);
+ if (VCWD_GETCWD(ftest, sizeof(ftest)) == NULL) {
+ strcpy(path,filename);
+ } else {
+ expand_filepath(filename, path TSRMLS_CC);
+ }
+
ret = VCWD_STAT(path, &sb);
if (ret < 0) {
if (mode == CHECKUID_DISALLOW_FILE_NOT_EXISTS) {