From 25188ddce906689b93e2e330d91e1471ca82716d Mon Sep 17 00:00:00 2001 From: Parnic Date: Tue, 26 Mar 2019 19:16:23 -0500 Subject: [PATCH] To be safe, only pass the chunk of the buffer that's relevant --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index c66c614..60850e8 100644 --- a/index.js +++ b/index.js @@ -141,7 +141,7 @@ class UnitConnection extends EventEmitter { bufferIdx = bufferIdx + msg.length; if (bufferIdx === expectedMsgLen) { - _this.onClientMessage(buffer); + _this.onClientMessage(buffer.slice(0, expectedMsgLen)); bufferIdx = 0; } }).on('close', function(had_error) {