diff --git a/psopacket/src/lib.rs b/psopacket/src/lib.rs index 6b6734f..f1c11b5 100644 --- a/psopacket/src/lib.rs +++ b/psopacket/src/lib.rs @@ -234,6 +234,10 @@ pub fn pso_packet(attr: TokenStream, item: TokenStream) -> TokenStream { let mut buf: Vec = Vec::new(); #(#as_bytes)* + while buf.len() % 4 != 0 { + buf.push(0); + } + let pkt_len = (buf.len() + 4) as u16; let mut prebuf: Vec = Vec::new();