diff --git a/src/core/tpkt.rs b/src/core/tpkt.rs index 8651c47..cb06e37 100644 --- a/src/core/tpkt.rs +++ b/src/core/tpkt.rs @@ -138,7 +138,7 @@ impl Client { // Minimal size must be 7 // https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-rdpbcgr/18a27ef9-6f9a-4501-b000-94b1fe3c2c10 - if size.inner() < 7 { + if size.inner() < 4 { Err(Error::RdpError(RdpError::new(RdpErrorKind::InvalidSize, "Invalid minimal size for TPKT"))) } else { @@ -155,14 +155,14 @@ impl Client { hi_length.read(&mut Cursor::new(self.transport.read(1)?))?; let length: u16 = ((short_length & !0x80) as u16) << 8; let length = length | hi_length as u16; - if length < 7 { + if length < 3 { Err(Error::RdpError(RdpError::new(RdpErrorKind::InvalidSize, "Invalid minimal size for TPKT"))) } else { Ok(Payload::FastPath(sec_flag, Cursor::new(self.transport.read(length as usize - 3)?))) } } else { - if short_length < 7 { + if short_length < 2 { Err(Error::RdpError(RdpError::new(RdpErrorKind::InvalidSize, "Invalid minimal size for TPKT"))) } else { Ok(Payload::FastPath(sec_flag, Cursor::new(self.transport.read(short_length as usize - 2)?)))