Skip to content

Commit

Permalink
net: Maximum packet payload is packet size minus header size
Browse files Browse the repository at this point in the history
Previously, packet payloads between 1390 and 1397 would get dropped by
this library.

Fixes #75.
  • Loading branch information
heinrich5991 committed Jul 16, 2023
1 parent c4e045d commit 092281c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion net/src/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ impl<'a> Packet<'a> {
payload
};

if payload.len() > MAX_PAYLOAD + TOKEN_SIZE {
if payload.len() > MAX_PACKETSIZE - HEADER_SIZE {
return Err(Compression);
}

Expand Down
2 changes: 1 addition & 1 deletion net/src/protocol7.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ impl<'a> Packet<'a> {
payload
};

if payload.len() > MAX_PAYLOAD {
if payload.len() > MAX_PACKETSIZE - HEADER_SIZE {
return Err(Compression);
}

Expand Down

0 comments on commit 092281c

Please sign in to comment.