diff --git a/lib/internal/crypto/random.js b/lib/internal/crypto/random.js index 88b535a357c4fa..f3fdf5f2f80104 100644 --- a/lib/internal/crypto/random.js +++ b/lib/internal/crypto/random.js @@ -155,7 +155,7 @@ function randomFill(buf, offset, size, callback) { if (typeof offset === 'function') { callback = offset; offset = 0; - size = buf.bytesLength; + size = buf.byteLength; } else if (typeof size === 'function') { callback = size; size = buf.byteLength - offset;