From 776ffea91c3a3e58dd4162c208e373fa2605e853 Mon Sep 17 00:00:00 2001 From: Emil Bay Date: Sun, 11 Jun 2017 10:44:02 +0200 Subject: [PATCH] Fix keygen overflow bug --- crypto_kdf.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crypto_kdf.js b/crypto_kdf.js index 1536250..1fef3ea 100644 --- a/crypto_kdf.js +++ b/crypto_kdf.js @@ -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)) }