Merge branch 'safe_u16_conversion' into 'main'

tor-cell: Consistent and secure conversion to u16

See merge request tpo/core/arti!803
This commit is contained in:
Nick Mathewson 2022-10-25 13:17:55 +00:00
commit 49ffb1cf4b
1 changed files with 1 additions and 1 deletions

View File

@ -194,7 +194,7 @@ impl msg::Body for EstablishIntro {
}
w.write_all(&self.handshake_auth[..]);
w.write_u16(self.sig.len() as u16);
w.write_u16(u16::try_from(self.sig.len()).map_err(|_| EncodeError::BadLengthValue)?);
w.write_all(&self.sig[..]);
Ok(())
}