Skip to content

Commit

Permalink
fragment fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
lsalzman committed Nov 14, 2024
1 parent 1e80a78 commit 657eaf9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion protocol.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 657eaf9

Please sign in to comment.