Skip to content

Conversation

cmb69
Copy link
Member

@cmb69 cmb69 commented Mar 5, 2020

open_basedir is only relevant for plain files, so there is no need to
check it for other URL wrappers.

open_basedir is only relevant for plain files, so there is no need to
check it for other URL wrappers.
@@ -1669,7 +1669,7 @@ PHP_FUNCTION(copy)
Z_PARAM_RESOURCE_EX(zcontext, 1, 0)
ZEND_PARSE_PARAMETERS_END();

if (php_check_open_basedir(source)) {
if (php_stream_locate_url_wrapper(source, NULL, 0) == &php_plain_files_wrapper && php_check_open_basedir(source)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If that's the case, shouldn't it be part of php_check_open_basedir itself?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Somehow that would be better, but it seems that a lot of related code assumes otherwise, and I'm not sure about the performance impact.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which code assumes otherwise?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bad wording, sorry! I mean that some code already checks whether a plain_files_wrapper is given, and only then calls php_check_open_basedir(), e.g.

if ((wrapper = php_stream_locate_url_wrapper(filename, &local, 0)) == &php_plain_files_wrapper && php_check_open_basedir(local)) {

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nikic, any suggestions on how to proceed here?

@cmb69
Copy link
Member Author

cmb69 commented Jun 30, 2020

Thanks! Applied as 7f3bc64.

@cmb69 cmb69 closed this Jun 30, 2020
@cmb69 cmb69 deleted the cmb/70362 branch June 30, 2020 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants