Skip to content

Fix #79491: Search for .user.ini extends up to root dir #5417

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

cmb69
Copy link
Member

@cmb69 cmb69 commented Apr 19, 2020

The start parameter of php_cgi_ini_activate_user_config is supposed
to hold the byte offset of the doc root in the given path. However,
the current expression which fixes a potential type incompatibility
will ever only evaluate to zero or one, because it uses the logical
and operator (&&). Furthermore we notice that subtracting one from
doc_root_len is not necessary, so there is even no need for the
start parameter at all.


Someone working on Linux may want to review the respective code in fpm_main.c; passing doc_root_len - 1 seems equally superfluous there. Contrary to the code in cgi_main.c, that doesn't look like a real bug, though.

The `start` parameter of `php_cgi_ini_activate_user_config` is supposed
to hold the byte offset of the doc root in the given `path`.  However,
the current expression which fixes a potential type incompatibility
will ever only evaluate to zero or one, because it uses the *logical*
and operator (`&&`).  Furthermore we notice that subtracting one from
`doc_root_len` is not necessary, so there is even no need for the
`start` parameter at all.
php-pulls pushed a commit that referenced this pull request Apr 20, 2020
This is the change from GH-5417 but for FPM. This was stripping the
last character from the doc_root. Given how it is used, this should
be harmless, but let's make it less confusing...
@nikic
Copy link
Member

nikic commented Apr 20, 2020

I've applied f62571c to the FPM code.

@cmb69
Copy link
Member Author

cmb69 commented Apr 20, 2020

Thanks! Applied as fa10abd.

@cmb69 cmb69 closed this Apr 20, 2020
@cmb69 cmb69 deleted the cmb/79491 branch April 20, 2020 09:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants