nrf/buffered_uarte: fix out of bounds on read.
This commit is contained in:
parent
13bcb5ffb6
commit
833b3a370a
@ -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