From 833b3a370a31b060884facbcd8eeeae68a43f4e1 Mon Sep 17 00:00:00 2001 From: Dario Nieuwenhuis Date: Sat, 14 May 2022 02:20:40 +0200 Subject: [PATCH] nrf/buffered_uarte: fix out of bounds on read. --- embassy-nrf/src/buffered_uarte.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/embassy-nrf/src/buffered_uarte.rs b/embassy-nrf/src/buffered_uarte.rs index fc4e9c8d..c42fa113 100644 --- a/embassy-nrf/src/buffered_uarte.rs +++ b/embassy-nrf/src/buffered_uarte.rs @@ -216,7 +216,7 @@ impl<'d, U: UarteInstance, T: TimerInstance> embedded_io::asynch::Read for Buffe let data = state.rx.pop_buf(); if !data.is_empty() { 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]); state.rx.pop(len); do_pend = true;