Skip to content

Commit

Permalink
serial: nrfx_uarte: check size before writing to buffer
Browse files Browse the repository at this point in the history
NRFX UARTE would write to user supplied buffer on IRQ without checking
whether or not the supplied buffer had available space left to write
one char

Signed-off-by: Arne Edholm <[email protected]>
  • Loading branch information
arneedh authored and carlescufi committed May 6, 2021
1 parent a71a8db commit 2b864ed
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/serial/uart_nrfx_uarte.c
Original file line number Diff line number Diff line change
Expand Up @@ -1452,7 +1452,7 @@ static int uarte_nrfx_fifo_read(const struct device *dev,
NRF_UARTE_Type *uarte = get_uarte_instance(dev);
const struct uarte_nrfx_data *data = get_dev_data(dev);

if (nrf_uarte_event_check(uarte, NRF_UARTE_EVENT_ENDRX)) {
if (size > 0 && nrf_uarte_event_check(uarte, NRF_UARTE_EVENT_ENDRX)) {
/* Clear the interrupt */
nrf_uarte_event_clear(uarte, NRF_UARTE_EVENT_ENDRX);

Expand Down

0 comments on commit 2b864ed

Please sign in to comment.