Fix crc validation
This commit is contained in:
+2
-1
@@ -9,7 +9,8 @@ message_validate(const union Message* message) {
|
|||||||
if(message->header.crc != crc8(message, 3))
|
if(message->header.crc != crc8(message, 3))
|
||||||
return MESSAGEERR_HEADERCRC;
|
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_FOOTERCRC;
|
||||||
|
|
||||||
return MESSAGEERR_NONE;
|
return MESSAGEERR_NONE;
|
||||||
|
|||||||
Reference in New Issue
Block a user