From a8a71db25871003fc7fcd06b43cba16d808ad94e Mon Sep 17 00:00:00 2001 From: Michael du Breuil Date: Mon, 8 Apr 2019 15:56:15 -0700 Subject: [PATCH] AP_HAL_SITL: Correct range check on UART ports Coverity CID 308362 --- libraries/AP_HAL_SITL/UARTDriver.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/AP_HAL_SITL/UARTDriver.cpp b/libraries/AP_HAL_SITL/UARTDriver.cpp index af0e09706a..e2aa12e81a 100644 --- a/libraries/AP_HAL_SITL/UARTDriver.cpp +++ b/libraries/AP_HAL_SITL/UARTDriver.cpp @@ -51,7 +51,7 @@ bool UARTDriver::_console; void UARTDriver::begin(uint32_t baud, uint16_t rxSpace, uint16_t txSpace) { - if (_portNumber > ARRAY_SIZE(_sitlState->_uart_path)) { + if (_portNumber >= ARRAY_SIZE(_sitlState->_uart_path)) { AP_HAL::panic("port number out of range; you may need to extend _sitlState->_uart_path"); }