From 842b8adc40abf1ac3e142b12eaf6f268950ad0cf Mon Sep 17 00:00:00 2001 From: Paul Date: Fri, 20 Sep 2019 16:52:53 +0200 Subject: [PATCH] extra check in calculating CRC --- src/ems.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/ems.cpp b/src/ems.cpp index 3ebcfe93c..05641ccba 100644 --- a/src/ems.cpp +++ b/src/ems.cpp @@ -454,6 +454,11 @@ void ems_tx_pollAck() { * len is length of all the data in bytes (including the header & CRC byte at end) */ uint8_t _crcCalculator(uint8_t * data, uint8_t len) { + + if (len <= 1) { + return 0; + } + uint8_t crc = 0; // read data and stop before the CRC