diff --git a/net/src/protocol.rs b/net/src/protocol.rs index 8808e23c..276a306f 100644 --- a/net/src/protocol.rs +++ b/net/src/protocol.rs @@ -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); } diff --git a/net/src/protocol7.rs b/net/src/protocol7.rs index 4d4df327..7ebda6af 100644 --- a/net/src/protocol7.rs +++ b/net/src/protocol7.rs @@ -194,7 +194,7 @@ impl<'a> Packet<'a> { payload }; - if payload.len() > MAX_PAYLOAD { + if payload.len() > MAX_PACKETSIZE - HEADER_SIZE { return Err(Compression); }