make sure buf length equals # of initialized bytes

This commit is contained in:
ousado 2018-06-25 16:36:04 +02:00 committed by GitHub
parent 0b4954ed79
commit 00240f9482
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 0 deletions

View File

@ -447,6 +447,7 @@ impl Stream for ChunkedReadFile {
if nbytes == 0 { if nbytes == 0 {
return Err(io::ErrorKind::UnexpectedEof.into()); return Err(io::ErrorKind::UnexpectedEof.into());
} }
unsafe { buf.set_len(nbytes); }
Ok((file, Bytes::from(buf))) Ok((file, Bytes::from(buf)))
})); }));
self.poll() self.poll()