[php-src] PR #21675: Fix GH-21673: password_verify() failed to verify bcrypt passwords containing null bytes
| From: | LamentXU123 | Date: | Wed, 08 Apr 2026 13:39:26 +0000 |
| Subject: | [php-src] PR #21675: Fix GH-21673: password_verify() failed to verify bcrypt passwords containing null bytes | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-35622@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/21675
Author: LamentXU123
Now, since including \0 in
password_hash is not allowed in PASSWORD_BCRYPT. It is
reasonable to add checkers that, makes input that includes \0 in password_verify
directly fails.
This PR align password_verify() with password_hash() for bcrypt by
rejecting passwords containing NUL bytes before verification.
Because bcrypt treats passwords as NUL-terminated C strings, this avoids ambiguous verification
behavior for inputs such as "foo\0bar". A regression test is included.