Code cleanup

This commit is contained in:
Adrien Gallouët
2016-12-22 11:03:18 +00:00
parent fe5499d46d
commit 2fd70eb14e

5
mud.c
View File

@@ -612,15 +612,12 @@ mud_get_mtu(struct mud *mud)
int int
mud_set_mtu(struct mud *mud, int mtu) mud_set_mtu(struct mud *mud, int mtu)
{ {
if (mtu <= 0) if (mtu <= 0 || mtu > MUD_PACKET_MAX_SIZE)
mtu = MUD_PACKET_MAX_SIZE; mtu = MUD_PACKET_MAX_SIZE;
if (mtu < sizeof(struct mud_packet)) if (mtu < sizeof(struct mud_packet))
mtu = sizeof(struct mud_packet); mtu = sizeof(struct mud_packet);
if (mtu > MUD_PACKET_MAX_SIZE)
mtu = MUD_PACKET_MAX_SIZE;
mtu -= MUD_PACKET_MIN_SIZE; mtu -= MUD_PACKET_MIN_SIZE;
struct mud_path *path; struct mud_path *path;