From cf4ce32afa9e7938bf1951da683e098eeb55a111 Mon Sep 17 00:00:00 2001 From: EAimTY Date: Tue, 30 May 2023 19:05:53 +0900 Subject: [PATCH] fix wrong packet length calculation --- tuic-quinn/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tuic-quinn/src/lib.rs b/tuic-quinn/src/lib.rs index 5ba43ef..a7e626a 100644 --- a/tuic-quinn/src/lib.rs +++ b/tuic-quinn/src/lib.rs @@ -233,7 +233,7 @@ impl Connection { if let Some(pkt) = self.model.recv_packet(pkt) { let pos = dg.position() as usize; let mut buf = dg.into_inner(); - if (pos + pkt.size() as usize) < buf.len() { + if (pos + pkt.size() as usize) <= buf.len() { buf = buf.slice(pos..pos + pkt.size() as usize); Ok(Task::Packet(Packet::new(pkt, PacketSource::Native(buf)))) } else {