Remove duplicated checks

Signed-off-by: Adrien Gallouët <adrien@gallouet.fr>
This commit is contained in:
Adrien Gallouët
2018-08-16 12:58:46 +00:00
parent 22e065e5cb
commit 5b9b3d5709

7
mud.c
View File

@@ -1467,15 +1467,10 @@ mud_send(struct mud *mud, const void *data, size_t size, unsigned tc)
if (!size || !mud->count)
return 0;
if (size > sizeof(packet) - MUD_PACKET_MIN_SIZE) {
errno = EMSGSIZE;
return -1;
}
const int packet_size = mud_encrypt(mud, now, packet, sizeof(packet), data, size);
if (!packet_size) {
errno = EINVAL;
errno = EMSGSIZE;
return -1;
}