Fix keygen overflow bug

This commit is contained in:
Emil Bay 2017-06-11 10:44:02 +02:00
parent 56913733b9
commit 776ffea91c
No known key found for this signature in database
GPG Key ID: AF1CF37B90FBF638

View File

@ -33,5 +33,5 @@ module.exports.crypto_kdf_derive_from_key = function crypto_kdf_derive_from_key
module.exports.crypto_kdf_keygen = function crypto_kdf_keygen (out) {
assert(out.length >= module.exports.crypto_kdf_KEYBYTES)
randombytes_buf(out, module.exports.crypto_kdf_KEYBYTES)
randombytes_buf(out.subarray(0, module.exports.crypto_kdf_KEYBYTES))
}