Fix crc validation

This commit is contained in:
2023-02-02 01:14:29 -06:00
parent ab22567f65
commit 0699fa5906
+2 -1
View File
@@ -9,7 +9,8 @@ message_validate(const union Message* message) {
if(message->header.crc != crc8(message, 3))
return MESSAGEERR_HEADERCRC;
if(message->header.crc != crc16(message, length - sizeof(struct Footer)))
struct Footer* footer = (void*)message + length - sizeof(struct Footer);
if(footer->crc != crc16(message, length - sizeof(struct Footer)))
return MESSAGEERR_FOOTERCRC;
return MESSAGEERR_NONE;