Fixed bug #42560: check open_basedir after the fallback to the system's temporary directory in tempnam() #6526
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
open_basedir
checking is done against the passed directory name before any fallback is processed.open_basedir
checking is done against the actual directory going to be used.The open_basedir checking continues to be skipped if PHP_TMP_FILE_OPEN_BASEDIR_CHECK isn't set.As a side effect of this fix, file uploads become to be always affected by the open_basedir checking. The current implementation seems to bypass the open_basedir checking when upload_tmp_dir is set.open_basedir
checking continues to be skipped ifPHP_TMP_FILE_OPEN_BASEDIR_CHECK_*
aren't set.PHP_TMP_FILE_OPEN_BASEDIR_CHECK
was originally added as a follow-up of Request #69489 #1246 , but was never used by the callers in php-src.open_basedir
check whenupload_tmp_dir
is explicitly set, I've introduced macros that can be used to specify whether the check should be performed, separately for fallback and explicitly specified directories.