diff --git a/src/protocol.rs b/src/protocol.rs index 577c7323..955346ef 100644 --- a/src/protocol.rs +++ b/src/protocol.rs @@ -112,8 +112,7 @@ impl UdpTraffic { } pub async fn read(reader: &mut T, hdr_len: u8) -> Result { - let mut buf = Vec::new(); - buf.resize(hdr_len as usize, 0); + let mut buf = vec![0; hdr_len as usize]; reader .read_exact(&mut buf) .await