diff --git a/src/main.rs b/src/main.rs index bcd562a..ad1eb45 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,5 @@ use chrono::{DateTime, Duration, Local}; +use core::num; use log::debug; use std::{collections::HashMap, net::UdpSocket, thread}; @@ -168,6 +169,15 @@ fn main() -> std::io::Result<()> { } }; + // Just do the very least of plausibility checks + if number_of_bytes < 2 { + // Abort if not at least 2 bytes have been received + continue; + } else if (buf[0] >> 6) != 1u8 { + // Abort if protocol version is not "1" + continue; + } + let client_addr = src_addr.to_string(); let speed = buf[1] >> 2; let data = &buf[0..number_of_bytes];