From 6edf4113a44298928bb570a111b1a1bc16d64d5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20Monda?= Date: Sun, 1 Oct 2017 22:05:20 +0200 Subject: [PATCH] Make the slave check message integrity and only process if it's valid. --- left/src/slave_protocol_handler.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/left/src/slave_protocol_handler.c b/left/src/slave_protocol_handler.c index b3afc24..fabb74a 100644 --- a/left/src/slave_protocol_handler.c +++ b/left/src/slave_protocol_handler.c @@ -35,6 +35,11 @@ void SetResponseByte(uint8_t response) void SlaveRxHandler(void) { + if (!CRC16_IsMessageValid(&RxMessage)) { + TxMessage.length = 0; + return; + } + uint8_t commandId = RxMessage.data[0]; switch (commandId) { case SlaveCommand_SetTestLed: