[mio] 使用实际长度判断

This commit is contained in:
lubeilin
2024-03-05 21:36:12 +08:00
parent 734e613452
commit a8a1346c98
+1 -1
View File
@@ -123,7 +123,7 @@ impl<B: AsRef<[u8]>> NetPacket<B> {
));
}
// 不能大于udp最大载荷长度
if data_len < 12 || buffer.as_ref().len() > 65535 - 20 - 8 {
if data_len < 12 || data_len > 65535 - 20 - 8 {
return Err(io::Error::new(
io::ErrorKind::InvalidData,
"length overflow",