Merge #772
772: nrf/buffered_uarte: fix out of bounds on read. r=Dirbaio a=Dirbaio
🙈
bors r+
Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
This commit is contained in:
commit
3d1501c020
@ -216,7 +216,7 @@ impl<'d, U: UarteInstance, T: TimerInstance> embedded_io::asynch::Read for Buffe
|
|||||||
let data = state.rx.pop_buf();
|
let data = state.rx.pop_buf();
|
||||||
if !data.is_empty() {
|
if !data.is_empty() {
|
||||||
trace!(" got {:?} {:?}", data.as_ptr() as u32, data.len());
|
trace!(" got {:?} {:?}", data.as_ptr() as u32, data.len());
|
||||||
let len = data.len().min(data.len());
|
let len = data.len().min(buf.len());
|
||||||
buf[..len].copy_from_slice(&data[..len]);
|
buf[..len].copy_from_slice(&data[..len]);
|
||||||
state.rx.pop(len);
|
state.rx.pop(len);
|
||||||
do_pend = true;
|
do_pend = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user