From 657eaf97d9d335917c58484a4a4b5e03838ebd8e Mon Sep 17 00:00:00 2001 From: Lee Salzman Date: Thu, 14 Nov 2024 00:50:03 -0500 Subject: fragment fixes --- protocol.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'protocol.c') diff --git a/protocol.c b/protocol.c index 1206b58..6f18efa 100644 --- a/protocol.c +++ b/protocol.c @@ -665,7 +665,8 @@ enet_protocol_handle_send_unreliable_fragment (ENetHost * host, ENetPeer * peer, fragmentLength = ENET_NET_TO_HOST_16 (command -> sendFragment.dataLength); * currentData += fragmentLength; - if (fragmentLength > host -> maximumPacketSize || + if (fragmentLength <= 0 || + fragmentLength > host -> maximumPacketSize || * currentData < host -> receivedData || * currentData > & host -> receivedData [host -> receivedDataLength]) return -1; @@ -695,6 +696,7 @@ enet_protocol_handle_send_unreliable_fragment (ENetHost * host, ENetPeer * peer, if (fragmentCount > ENET_PROTOCOL_MAXIMUM_FRAGMENT_COUNT || fragmentNumber >= fragmentCount || totalLength > host -> maximumPacketSize || + totalLength < fragmentCount || fragmentOffset >= totalLength || fragmentLength > totalLength - fragmentOffset) return -1; -- cgit v1.2.3