From 0977c5c13372bf71050c0fcd129e321832c1fc85 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Fri, 8 Jun 2018 04:16:59 -0700 Subject: [PATCH] net: fix nonce creation. --- lib/net/common.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/net/common.js b/lib/net/common.js index 13b78c0f..c5342cde 100644 --- a/lib/net/common.js +++ b/lib/net/common.js @@ -167,8 +167,8 @@ exports.BAN_SCORE = 100; exports.nonce = function nonce() { const data = Buffer.allocUnsafe(8); - data.writeUInt32LE(Math.random() * 0x100000000, true, 0); - data.writeUInt32LE(Math.random() * 0x100000000, true, 4); + data.writeUInt32LE((Math.random() * 0x100000000) >>> 0, 0, true); + data.writeUInt32LE((Math.random() * 0x100000000) >>> 0, 4, true); return data; };