Fixed usize size issue for 32-bit platforms

This commit is contained in:
Joshua Barretto 2019-06-08 11:15:40 +01:00
parent 3285fc9b88
commit c445e76afa

View File

@ -267,9 +267,9 @@ impl<S: PostMsg, R: PostMsg> PostBox<S, R> {
for _ in 0..100 {
match incoming_buf.get(0..9) {
Some(len_bytes) => {
let len = usize::from_le_bytes(
let len = u64::from_le_bytes(
<[u8; 8]>::try_from(&len_bytes[0..8]).unwrap(),
); // Can't fail
) as usize; // Can't fail
if len > MAX_MSG_SIZE {
recv_tx.send(Err(Error::InvalidMessage)).unwrap();