md5, sha1, openssl - using zend_bin2hex instead of local helper - #23819
Conversation
| /* Some callers (e.g. ext/soap's WSDL cache key) memcpy() the whole | ||
| buffer including this terminator, so it must still be written here; | ||
| zend_bin2hex() itself does not null-terminate. */ | ||
| md5str[len * 2] = '\0'; |
There was a problem hiding this comment.
This would probably be nicer if zend_bin2hex() either returned the end pointer or the length of data written.
There was a problem hiding this comment.
I generally agree it's a good suggestion, but it doesn't directly relate to the changes in this PR - the same pattern exists in other places where it was substituted previously. I'd rather implement this suggestion in a separate PR and for all the places.
There was a problem hiding this comment.
I'd rather implement this suggestion in a separate PR and for all the places.
Yes, I didn't mean to say that it should be done as part of this PR. I just noticed when looking at this one for a possible follow-up.
|
Thank you. Plus, several days ago I came across some code in other extensions that implement hex2bin itself. I think this might be possible follow-up. #23821 |
Another follow-up for #21724 — found a couple more places using a local hex-encode helper instead of zend_bin2hex(). Changes are basically the same shape as #21832 did for the ext/hash callers, just for md5()/sha1() and the two ext/openssl spots (openssl_digest(), openssl_x509_fingerprint()) that never depended on ext/hash so #21832 didn't touch them.