From c6bafbcb48747b961eee8b82f39e22ad0f54ee27 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Tue, 24 Jun 2014 00:43:37 -0500 Subject: [PATCH] fix: ensure user agent is less than 0xfd in length. we can assume the varint is 1 byte. --- lib/bcoin/protocol/framer.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/bcoin/protocol/framer.js b/lib/bcoin/protocol/framer.js index b25c7b5d..0b216fc9 100644 --- a/lib/bcoin/protocol/framer.js +++ b/lib/bcoin/protocol/framer.js @@ -14,7 +14,9 @@ function Framer(options) { options = options || {}; this.options = options; + this.agent = utils.toArray(options.agent || '/bcoin:' + version + '/'); + this.agent = this.agent.slice(0, 0xfc); } module.exports = Framer;