From: Robert Thompson Date: Wed, 10 Oct 2007 22:52:58 +0000 (+0000) Subject: Fix for bug 41899, safe mode and relative paths with Solaris's broken getcwd(). X-Git-Tag: RELEASE_1_3_1~861 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=50250dff8c5e1e6d47b309dc904b180e42d54065;p=php Fix for bug 41899, safe mode and relative paths with Solaris's broken getcwd(). --- 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) {