Limit deserialization of data coming off the wire (#6751)

* Limit deserialization of data coming off the wire

* Feedback and cleanup
This commit is contained in:
Jack May
2019-11-06 00:07:57 -08:00
committed by GitHub
parent 8e3be6413e
commit 9614d17024
9 changed files with 49 additions and 28 deletions

View File

@ -115,7 +115,9 @@ impl Shred {
where
T: Deserialize<'de>,
{
let ret = bincode::deserialize(&buf[*index..*index + size])?;
let ret = bincode::config()
.limit(PACKET_DATA_SIZE as u64)
.deserialize(&buf[*index..*index + size])?;
*index += size;
Ok(ret)
}