mirror of
https://github.com/php/php-src.git
synced 2024-11-25 19:05:31 +08:00
- Fix bug when using safe_mode and doc_root together
This commit is contained in:
parent
47f8af85f5
commit
4a2fa70fc9
@ -413,16 +413,12 @@ PHPAPI FILE *php_fopen_with_path(char *filename, char *mode, char *path, char **
|
||||
#else
|
||||
if (IS_SLASH(*filename)) {
|
||||
#endif
|
||||
if (PG(safe_mode)) {
|
||||
if(PG(doc_root)) {
|
||||
snprintf(trypath, MAXPATHLEN, "%s%s", PG(doc_root), filename);
|
||||
} else {
|
||||
strlcpy(trypath,filename,sizeof(trypath));
|
||||
}
|
||||
if (PG(safe_mode)&& PG(doc_root)) {
|
||||
snprintf(trypath, MAXPATHLEN, "%s%s", PG(doc_root), filename);
|
||||
if (!php_checkuid(trypath, mode, 0)) {
|
||||
return NULL;
|
||||
}
|
||||
return php_fopen_and_set_opened_path(filename, mode, opened_path);
|
||||
return php_fopen_and_set_opened_path(trypath, mode, opened_path);
|
||||
} else {
|
||||
return php_fopen_and_set_opened_path(filename, mode, opened_path);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user