From 17cf4bb05659695b625e2643f43ef93084ce1007 Mon Sep 17 00:00:00 2001 From: Jake Probst Date: Sun, 23 Jun 2019 15:51:29 -0700 Subject: [PATCH] make sure packet len is divisible by 4 --- psopacket/src/lib.rs | 4 ++++ 1 file changed, 4 insertions(+) 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();