Fix off-by-one max payload checks

This commit is contained in:
Justin Starry
2020-09-15 15:25:00 +08:00
committed by Michael Vines
parent c231bb7154
commit f6cda2579f
4 changed files with 4 additions and 4 deletions

View File

@ -27,7 +27,7 @@ fn producer(addr: &SocketAddr, exit: Arc<AtomicBool>) -> JoinHandle<()> {
let mut num = 0;
for p in &msgs.packets {
let a = p.meta.addr();
assert!(p.meta.size < PACKET_DATA_SIZE);
assert!(p.meta.size <= PACKET_DATA_SIZE);
send.send_to(&p.data[..p.meta.size], &a).unwrap();
num += 1;
}