From b0b871c07611929fb3901f5e118a3edcc6ad1765 Mon Sep 17 00:00:00 2001 From: devl0rd Date: Wed, 29 Apr 2020 15:57:10 -0600 Subject: [PATCH] check buffer stream clip length --- SkyNX-Streamer/NxStreamingService/main.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/SkyNX-Streamer/NxStreamingService/main.js b/SkyNX-Streamer/NxStreamingService/main.js index f0bf3fa..048fe4d 100644 --- a/SkyNX-Streamer/NxStreamingService/main.js +++ b/SkyNX-Streamer/NxStreamingService/main.js @@ -482,11 +482,14 @@ hidStreamClient.on('data', function (chunk) { if (hidDataBuffer.includes("ffffffffffffffff") && hidDataBuffer.includes("ffffffffffffff7")) { completeData = hidDataBuffer.split("ffffffffffffffff")[1].split("ffffffffffffff7")[0]; hidDataBuffer = ""; + if (completeData.length != 416) { + console.log("Incorrect data length: " + completeData.length + " - " + completeData); + return + } } else { return; } var data = Buffer.from(completeData, 'hex'); - console.log(data) var hid = parseInputStruct(data); var controllerCount = hid.get("controllerCount");