Signed-off-by: Adrien Gallouët <adrien@gallouet.fr>
This commit is contained in:
Adrien Gallouët
2018-02-15 14:17:55 +00:00
parent 6e5e2dea64
commit 7013d8e323

4
mud.c
View File

@@ -1048,15 +1048,11 @@ 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_conf] = MUD_PACKET_SIZE(sizeof(packet->data.conf)),
[mud_stat] = MUD_PACKET_SIZE(sizeof(packet->data.stat)),
};
// clang-format on
return (packet->hdr.code >= sizeof(sizes)) ||
(sizes[packet->hdr.code] != size);
}