Skip to content
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

Fix #80933: SplFileObject::fgets() stops at NUL byte for DROP_NEW_LINE #6836

Closed
wants to merge 6 commits into from

Conversation

cmb69
Copy link
Contributor

@cmb69 cmb69 commented Apr 5, 2021

buf may contain NUL bytes, so we must not use strcspn() but rather
the binary safe php_strcspn().

Signed-off-by: Christoph M. Becker cmbecker69@gmx.de

`buf` may contain NUL bytes, so we must not use `strcspn()` but rather
the binary safe `php_strcspn()`.

Signed-off-by: Christoph M. Becker <cmbecker69@gmx.de>
@cmb69 cmb69 added the Bug label Apr 5, 2021
@cmb69 cmb69 marked this pull request as draft April 5, 2021 16:44
`php_strcspn()` expects `char*`s prior to PHP 8.0.0.

Signed-off-by: Christoph M. Becker <cmbecker69@gmx.de>
@cmb69 cmb69 marked this pull request as ready for review April 5, 2021 20:36
We must not assume that either CR or LF are valid line endings, but
should use `php_stream_locate_eol()` in the first place.
@cmb69
Copy link
Contributor Author

cmb69 commented Apr 7, 2021

Like mentioned in the bug report, there is a more general issue regarding the detection of valid line endings. This should be addressed by my latest commit.

ext/spl/spl_directory.c Outdated Show resolved Hide resolved
ext/spl/spl_directory.c Outdated Show resolved Hide resolved
Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
@cmb69 cmb69 closed this in 976e71a Apr 13, 2021
@cmb69 cmb69 deleted the cmb/80933 branch April 13, 2021 15:10
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.

None yet

2 participants