Skip to content

Commit

Permalink
Reset too big packet lengths back to None
Browse files Browse the repository at this point in the history
  • Loading branch information
madmo committed Nov 23, 2023
1 parent da875e9 commit 698fd81
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/de/packet_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ impl<'a> PacketReader<'a> {
}
}

if let Some(packet_length) = self.packet_length {
if packet_length > self.buffer.len() {
self.packet_length = None;
}
}

// We should have found the packet length by now.
if self.read_bytes >= 5 && self.packet_length.is_none() {
return Err(Error::MalformedPacket);
Expand Down

0 comments on commit 698fd81

Please sign in to comment.