summaryrefslogtreecommitdiff
path: root/ext/hash/hash.c
diff options
context:
space:
mode:
authorAnthony Ferrara <ircmaxell@gmail.com>2013-05-28 15:30:45 -0400
committerAnthony Ferrara <ircmaxell@gmail.com>2013-05-28 15:30:45 -0400
commit540a5a52e89fce6da19d6f79dd1eda587a25b396 (patch)
tree69d3bb628f8d3516c5acb0c23c2fd2f67365be56 /ext/hash/hash.c
parent2f01e06786c6f4b2479fdb728bd26062d07208e0 (diff)
downloadphp-git-540a5a52e89fce6da19d6f79dd1eda587a25b396.tar.gz
Fix #64745 hash_pbkdf2 truncation issue
When using hash_pbkdf2 with hex output and 0 length (auto), it incorrectly truncates the result to 1/2 the expected result.
Diffstat (limited to 'ext/hash/hash.c')
-rw-r--r--ext/hash/hash.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/ext/hash/hash.c b/ext/hash/hash.c
index 9492387dbb..9cede14125 100644
--- a/ext/hash/hash.c
+++ b/ext/hash/hash.c
@@ -659,6 +659,9 @@ PHP_FUNCTION(hash_pbkdf2)
/* Setup Main Loop to build a long enough result */
if (length == 0) {
length = ops->digest_size;
+ if (!raw_output) {
+ length = length * 2;
+ }
}
digest_length = length;
if (!raw_output) {