atmel-samd: Fix potential buffer overflow in UART.c by recalculating
the buffer end rather than naively adding 1. It could have needed to wrap around. Thanks @dhalbert for spotting the bug. Fixes #132
This commit is contained in:
parent
3660023046
commit
c82b84e0a9
|
@ -105,8 +105,9 @@ static void _busio_uart_interrupt_handler(uint8_t instance)
|
|||
self->buffer_size++;
|
||||
|
||||
if (module->character_size == USART_CHARACTER_SIZE_9BIT) {
|
||||
buffer_end = (self->buffer_start + self->buffer_size) % self->buffer_length;
|
||||
/* 9-bit data, write next received byte to the buffer */
|
||||
self->buffer[buffer_end + 1] = (received_data >> 8);
|
||||
self->buffer[buffer_end] = (received_data >> 8);
|
||||
self->buffer_size++;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue