Check for len + 1 instead of len when seeing if we have enough bytes in the stream

This commit is contained in:
Ryan Leckey
2019-07-18 10:31:44 -07:00
parent 3599d50811
commit f4c0ac0485

View File

@@ -43,7 +43,7 @@ impl Message {
// FIXME: What happens if len(u32) < len(usize) ?
let len = BigEndian::read_u32(&src[1..5]) as usize;
if src.len() < len {
if src.len() < (len + 1) {
// We don't have enough in the stream yet
return Ok(None);
}