fix: don't abort parsing packets if they have larger than 0 size
This commit is contained in:
parent
f1c1b2c122
commit
5233570675
1 changed files with 1 additions and 2 deletions
|
|
@ -6,7 +6,6 @@ use tokio::io;
|
|||
use tokio::io::AsyncReadExt;
|
||||
use tokio::io::AsyncWriteExt;
|
||||
use tokio::net::TcpStream;
|
||||
use tracing::instrument;
|
||||
|
||||
use crate::types::VarInt;
|
||||
pub mod clientbound;
|
||||
|
|
@ -81,7 +80,7 @@ impl Packet {
|
|||
if data_size > u16::MAX.into() {
|
||||
return Err(ParseError::LengthIsTooBig(length.get_int()).into());
|
||||
}
|
||||
if data_size > 0 {
|
||||
if data_size < 0 {
|
||||
return Err(ParseError::PacketLengthInvalid(length.get_int()).into());
|
||||
}
|
||||
// TODO: this is a bandaid fix; the above checks *should* make sure the
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue