diff --git a/src/fs/file.rs b/src/fs/file.rs index 1930fdd6..2ff5643e 100644 --- a/src/fs/file.rs +++ b/src/fs/file.rs @@ -673,7 +673,7 @@ impl LockGuard { if available > 0 || self.cache.is_empty() { // Copy data from the cache into the buffer. let n = cmp::min(available, buf.len()); - buf[..n].copy_from_slice(&self.cache[start..n]); + buf[..n].copy_from_slice(&self.cache[start..(start + n)]); // Move the read cursor forward. self.mode = Mode::Reading(start + n);