aboutsummaryrefslogtreecommitdiffstats
path: root/src/protocol/controller.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/protocol/controller.rs')
-rw-r--r--src/protocol/controller.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/protocol/controller.rs b/src/protocol/controller.rs
index 9c0a2fb..d4a0680 100644
--- a/src/protocol/controller.rs
+++ b/src/protocol/controller.rs
@@ -347,7 +347,11 @@ fn udp_process_transport(wg: &WgState, tun: &Tun, p: &[u8], addr: SocketAddr) {
if peer1.is_none() || !Arc::ptr_eq(&peer0, &peer1.unwrap()) {
debug!("Get transport message: allowed IPs check failed.");
} else {
- tun.write(&decrypted[..len as usize]).unwrap();
+ if len as usize <= decrypted.len() {
+ tun.write(&decrypted[..len as usize]).unwrap();
+ } else {
+ debug!("Get transport message: packet truncated?");
+ }
}
}
peer.on_recv(decrypted.len() == 0);