diff options
| author | Robert Thompson <ab5602@php.net> | 2007-10-10 22:52:58 +0000 |
|---|---|---|
| committer | Robert Thompson <ab5602@php.net> | 2007-10-10 22:52:58 +0000 |
| commit | 50250dff8c5e1e6d47b309dc904b180e42d54065 (patch) | |
| tree | 3898e59baf6047cc76ea0a5a86e4f7baaa227f9b | |
| parent | 0c6e83258486c00d25df445f87fb52f1e0f65f0c (diff) | |
| download | php-git-50250dff8c5e1e6d47b309dc904b180e42d54065.tar.gz | |
Fix for bug 41899, safe mode and relative paths with Solaris's broken getcwd().
| -rw-r--r-- | main/safe_mode.c | 10 |
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) { |
