From 0e020f2aa47391d8c5ec6e507ddde097f18b1ab8 Mon Sep 17 00:00:00 2001 From: Grigori Goronzy Date: Sun, 3 Jan 2021 16:10:05 +0100 Subject: [PATCH] protocols: fix off-by-one in payload extraction Drop all of the checksum bytes. This didn't take the end-of-frame marker into account. --- stcgal/protocols.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stcgal/protocols.py b/stcgal/protocols.py index 6ce408a..f43a6b8 100644 --- a/stcgal/protocols.py +++ b/stcgal/protocols.py @@ -417,7 +417,7 @@ class Stc89Protocol(StcBaseProtocol): raise StcFramingException("packet checksum mismatch") payload = StcBaseProtocol.extract_payload(self, packet) - return payload[:-1] + return payload[:-2] def write_packet(self, packet_data): """Send packet to MCU. @@ -812,7 +812,7 @@ class Stc12BaseProtocol(StcBaseProtocol): raise StcFramingException("packet checksum mismatch") payload = StcBaseProtocol.extract_payload(self, packet) - return payload[:-2] + return payload[:-3] def write_packet(self, packet_data): """Send packet to MCU.