Skip to content

Commit d60e7cc

Browse files
committed
Fix wrong slice index when reading a file
1 parent 6d2a43e commit d60e7cc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/fs/file.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,7 @@ impl LockGuard<State> {
673673
if available > 0 || self.cache.is_empty() {
674674
// Copy data from the cache into the buffer.
675675
let n = cmp::min(available, buf.len());
676-
buf[..n].copy_from_slice(&self.cache[start..n]);
676+
buf[..n].copy_from_slice(&self.cache[start..(start + n)]);
677677

678678
// Move the read cursor forward.
679679
self.mode = Mode::Reading(start + n);

0 commit comments

Comments
 (0)