Skip to content

Avoid OOB reads in create_name_with_username() #6968

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 2 commits into from

Conversation

cmb69
Copy link
Member

@cmb69 cmb69 commented May 10, 2021

accel_uname_id and zend_system_id are MD5 buffers which are not
NUL terminated. Thus, we must not pass them to snprintf().

`accel_uname_id` and `zend_system_id` are MD5 buffers which are not
NUL terminated.  Thus, we must not pass them to `snprintf()`.
@cmb69
Copy link
Member Author

cmb69 commented May 10, 2021

Hm, might better use sizeof instead of 32, but what if the buffers will be created on the heap some time? These buffer sizes should be macros.

@nikic
Copy link
Member

nikic commented May 14, 2021

Hm, might better use sizeof instead of 32, but what if the buffers will be created on the heap some time? These buffer sizes should be macros.

Yeah, adding macros for those sounds like a good idea.

@cmb69
Copy link
Member Author

cmb69 commented May 17, 2021

Yeah, adding macros for those sounds like a good idea.

Done. But especially in zend_file_cache_get_bin_file_path() is still room for improvement.

@krakjoe krakjoe added the Bug label May 27, 2021
@cmb69
Copy link
Member Author

cmb69 commented Jun 1, 2021

Is this good to be merged, or are there any objections?

@cmb69 cmb69 closed this in b184073 Jul 4, 2021
@cmb69
Copy link
Member Author

cmb69 commented Jul 4, 2021

I've applied only the first commit to PHP-7.4+. I'll do a new PR regarding ACCEL_SYSTEM_ID_LEN and ACCEL_UNAME_ID_LEN ASAP.

@cmb69 cmb69 deleted the cmb/create_name_with_username branch February 14, 2025 16:45
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