fix uart out of bounds warning

This commit is contained in:
MichaelDvP
2021-03-22 17:05:56 +01:00
parent 355b71cacf
commit 71dfc0e1eb
2 changed files with 6 additions and 4 deletions

View File

@@ -67,9 +67,11 @@ void IRAM_ATTR EMSuart::emsuart_rx_intr_handler(void * para) {
drop_next_rx_ = true; // we have a overflow drop_next_rx_ = true; // we have a overflow
} }
} }
if (length > 0 && length < EMS_MAXBUFFERSIZE) {
if (rxbuf[length - 1]) { // check if last byte is break if (rxbuf[length - 1]) { // check if last byte is break
length++; length++;
} }
}
if ((!drop_next_rx_) && ((length == 2) || (length > 4))) { if ((!drop_next_rx_) && ((length == 2) || (length > 4))) {
int baseType = 0; int baseType = 0;
xRingbufferSendFromISR(buf_handle_, rxbuf, length - 1, &baseType); xRingbufferSendFromISR(buf_handle_, rxbuf, length - 1, &baseType);