From 085ed6ee0454ae9b4a10e579cbae6aa4e5904f25 Mon Sep 17 00:00:00 2001 From: trivernis Date: Thu, 10 Sep 2020 17:54:05 +0200 Subject: [PATCH] Fix zero bytes being used when deserializing Signed-off-by: trivernis --- src/server.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/server.rs b/src/server.rs index 9ed1b87..2cc4424 100644 --- a/src/server.rs +++ b/src/server.rs @@ -69,8 +69,8 @@ impl RpcServer { for _ in 0..(length as f32 / BUF_SIZE as f32).ceil() as usize { let mut buf = [0u8; BUF_SIZE]; - incoming.read(&mut buf)?; - data.append(&mut buf.to_vec()) + let read_size = incoming.read(&mut buf)?; + data.append(&mut buf[0..read_size].to_vec()) } log::trace!("Message read as {:?}", data);