Fixed bug #75221 (Argon2i always throws NUL at the end)#2759
Closed
cmb69 wants to merge 1 commit intophp:masterfrom
Closed
Fixed bug #75221 (Argon2i always throws NUL at the end)#2759cmb69 wants to merge 1 commit intophp:masterfrom
cmb69 wants to merge 1 commit intophp:masterfrom
Conversation
Apparently, `argon2_encodedlen()` also counts the terminating NUL byte; that doesn't appear to be documented somewhere, but from looking at the implementation[1] it is pretty obvious. Therefore, the respective `zend_string` has to be one byte shorter. [1] <https://github.com/P-H-C/phc-winner-argon2/blob/20161029/src/argon2.c#L431-L436>
Member
Author
|
Note that the implementation feels a bit hackish; using |
weltling
reviewed
Oct 12, 2017
| ZSTR_LEN(out), | ||
| ZSTR_VAL(encoded), | ||
| ZSTR_LEN(encoded), | ||
| ZSTR_LEN(encoded) + 1, |
There was a problem hiding this comment.
Perhaps could just put encoded_len here? But anyway seems you've nailed the case.
Thanks.
Member
Author
There was a problem hiding this comment.
Ah, yes, encoded_len appears to be better. Thanks. I'm going to apply the modified PR against PHP-7.2.
|
Comment on behalf of cmb at php.net: Applied with 3f8961d |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Apparently,
argon2_encodedlen()also counts the terminating NUL byte;that doesn't appear to be documented somewhere, but from looking at the
implementation[1] it is pretty obvious. Therefore, the respective
zend_stringhas to be one byte shorter.[1] https://github.com/P-H-C/phc-winner-argon2/blob/20161029/src/argon2.c#L431-L436