mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-06-24 08:58:46 +00:00
fix(core): fix NRF communication long message check
[no changelog]
This commit is contained in:
parent
93f20bead1
commit
c97dd18c2d
@ -524,14 +524,13 @@ void HAL_UART_RxCpltCallback(UART_HandleTypeDef *urt) {
|
|||||||
} else if (drv->rx_idx >= UART_HEADER_SIZE &&
|
} else if (drv->rx_idx >= UART_HEADER_SIZE &&
|
||||||
drv->rx_idx < (drv->rx_len - 1)) {
|
drv->rx_idx < (drv->rx_len - 1)) {
|
||||||
// receive the rest of the message
|
// receive the rest of the message
|
||||||
|
if (drv->rx_idx >= NRF_MAX_TX_DATA_SIZE + UART_HEADER_SIZE) {
|
||||||
drv->rx_buffer.data[drv->rx_idx - UART_HEADER_SIZE] = drv->rx_byte;
|
|
||||||
drv->rx_idx++;
|
|
||||||
|
|
||||||
if (drv->rx_idx >= NRF_MAX_TX_DATA_SIZE) {
|
|
||||||
// message is too long, flush the line
|
// message is too long, flush the line
|
||||||
drv->rx_idx = 0;
|
drv->rx_idx = 0;
|
||||||
drv->rx_len = 0;
|
drv->rx_len = 0;
|
||||||
|
} else {
|
||||||
|
drv->rx_buffer.data[drv->rx_idx - UART_HEADER_SIZE] = drv->rx_byte;
|
||||||
|
drv->rx_idx++;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (drv->rx_idx == (drv->rx_len - 1)) {
|
} else if (drv->rx_idx == (drv->rx_len - 1)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user