From 20a4907ea0610c6ad102a85d7cc412f8e12d4c7b Mon Sep 17 00:00:00 2001 From: PoliEcho Date: Fri, 1 Aug 2025 18:44:44 +0200 Subject: [PATCH] remove off by one error --- src/client/net.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/client/net.rs b/src/client/net.rs index abb8b20..a14a1c3 100644 --- a/src/client/net.rs +++ b/src/client/net.rs @@ -432,7 +432,7 @@ pub async fn handle_incoming_connection( &network.read().unwrap().key, &buf[P2PStandardDataPositions::IV as usize ..P2PStandardDataPositions::IV as usize + BLOCK_SIZE], - &buf[P2PStandardDataPositions::DATA as usize..data_lenght as usize-1 /*compensate for size and index diference*/], + &buf[P2PStandardDataPositions::DATA as usize..data_lenght as usize], ) { Ok(data) => match tun_iface.send(&data) { Ok(_) => {} @@ -449,7 +449,7 @@ pub async fn handle_incoming_connection( ), } } else { - match tun_iface.send(&buf[P2PStandardDataPositions::DATA as usize..data_lenght as usize-1 /*compensate for size and index diference*/]) { + match tun_iface.send(&buf[P2PStandardDataPositions::DATA as usize..data_lenght as usize]) { Ok(_) => {}, Err(e) => eprintln!("{} failed to write packet to tun interface, Error: {}", "[WARNING]".yellow(), e), };