mirror of
https://github.com/async-rs/async-std.git
synced 2025-02-06 04:35:32 +00:00
Fix wrong slice index when reading a file
This commit is contained in:
parent
6d2a43e336
commit
d60e7cc27d
1 changed files with 1 additions and 1 deletions
|
@ -673,7 +673,7 @@ impl LockGuard<State> {
|
|||
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);
|
||||
|
|
Loading…
Reference in a new issue