From 00240f9482d6d511b54bf6a87648064f51f9b9cc Mon Sep 17 00:00:00 2001 From: ousado Date: Mon, 25 Jun 2018 16:36:04 +0200 Subject: [PATCH] make sure buf length equals # of initialized bytes --- src/fs.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/fs.rs b/src/fs.rs index bddd7b214..b6ea0fb22 100644 --- a/src/fs.rs +++ b/src/fs.rs @@ -447,6 +447,7 @@ impl Stream for ChunkedReadFile { if nbytes == 0 { return Err(io::ErrorKind::UnexpectedEof.into()); } + unsafe { buf.set_len(nbytes); } Ok((file, Bytes::from(buf))) })); self.poll()