diff --git a/mud.c b/mud.c index 7daf5d0..e1e3bf8 100644 --- a/mud.c +++ b/mud.c @@ -4,19 +4,21 @@ #define __APPLE_USE_RFC_3542 #endif -#include #include #include #include -#include #include #include +#include +#include + #include #include #include + +#include #include -#include -#include +#include #include @@ -975,13 +977,14 @@ mud_packet_check_size(unsigned char *data, size_t size) if (size <= MUD_PACKET_SIZE(0)) return -1; + // clang-format off const size_t sizes[] = { [mud_kiss] = MUD_PACKET_SIZE(sizeof(packet->data.kiss)), [mud_stat] = MUD_PACKET_SIZE(sizeof(packet->data.stat)), [mud_keyx] = MUD_PACKET_SIZE(sizeof(packet->data.public)), [mud_mtux] = MUD_PACKET_SIZE(sizeof(packet->data.mtu)), [mud_bakx] = MUD_PACKET_SIZE(sizeof(packet->data.backup)), - }; + }; // clang-format on return (packet->hdr.code >= sizeof(sizes)) || (sizes[packet->hdr.code] != size); @@ -999,8 +1002,7 @@ mud_packet_check(struct mud *mud, unsigned char *data, size_t size) .size = MUD_MAC_SIZE, }, .ad = { - .data = data, - .size = size - MUD_MAC_SIZE, + .data = data, .size = size - MUD_MAC_SIZE, }, };