From c194ac738f684e683a64aa3e3ac4846822a1a3ae Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Fri, 17 May 2019 13:34:57 +0200 Subject: [PATCH] compare crc/lrc against expected_crc , return and flush recveive buffer if they don't match --- lib/transport/ascii.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/transport/ascii.js b/lib/transport/ascii.js index 334e07e..a62678d 100644 --- a/lib/transport/ascii.js +++ b/lib/transport/ascii.js @@ -63,6 +63,11 @@ Transport.prototype.unwrap = function (data) { stream : this.stream }; + if (unwrapped.crc != unwrapped.expected_crc) { + this.buffer = null; + return false; + } + if (typeof this.callback == "function") { if (unwrapped.slaveId != this.callbackSlaveId) return false;