Fix crc validation

refactor
PgSocks 2 years ago
parent ab22567f65
commit 0699fa5906

@ -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;

Loading…
Cancel
Save