Skip to content

Fix NULL dereference in php_init_config() for unresolvable search path ini - #25882

Open
jorgsowa wants to merge 1 commit into
php:PHP-8.4from
jorgsowa:fix-ini-search-path-opened-path
Open

jorgsowa wants to merge 1 commit into
php:PHP-8.4from
jorgsowa:fix-ini-search-path-opened-path

Conversation

@jorgsowa

Copy link
Copy Markdown
Contributor

Follow-up to #24139 / #24141 (c88c89e), which fixed this for -c naming a file directly, but not for the search path lookups of php-<sapi>.ini and php.ini.

php_fopen_with_path() can open the file and still leave opened_path NULL when the cwd plus the relative path exceeds MAXPATHLEN. php_init_config() then takes ZSTR_VAL(NULL) and zend_stream_init_fp() crashes in strlen(). The file is now rejected in that case, as in the -c <file> branch.

…h ini

php_fopen_with_path() may open the file but leave opened_path NULL when
the absolute path exceeds MAXPATHLEN. Reject the file in that case so
the search continues with the next directory, as on ZTS, and as
c88c89e does for -c naming a file.
@jorgsowa jorgsowa self-assigned this Nov 28, 2026
@jorgsowa
jorgsowa requested a review from bukka as a code owner November 28, 2026 19:32
@jorgsowa jorgsowa changed the title Fix NULL dereference in php_init_config() for unresolvable search pat… Fix NULL dereference in php_init_config() for unresolvable search path ini Nov 28, 2026
@jorgsowa
jorgsowa force-pushed the fix-ini-search-path-opened-path branch from 7e00a4b to d335b15 Compare November 28, 2026 19:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant