From a0175441a089c9924ea949de1ab6ac8b2da6034e Mon Sep 17 00:00:00 2001 From: Pierre Kancir Date: Tue, 10 Aug 2021 17:41:16 +0200 Subject: [PATCH] AP_ESC_Telem: fix out of bound access --- libraries/AP_ESC_Telem/AP_ESC_Telem.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/AP_ESC_Telem/AP_ESC_Telem.h b/libraries/AP_ESC_Telem/AP_ESC_Telem.h index b9e43113ff..b427031a0a 100644 --- a/libraries/AP_ESC_Telem/AP_ESC_Telem.h +++ b/libraries/AP_ESC_Telem/AP_ESC_Telem.h @@ -68,7 +68,7 @@ public: // return the last time telemetry data was received in ms for the given ESC or 0 if never uint32_t get_last_telem_data_ms(uint8_t esc_index) const { - if (esc_index > ESC_TELEM_MAX_ESCS) return 0; + if (esc_index >= ESC_TELEM_MAX_ESCS) {return 0;} return _telem_data[esc_index].last_update_ms; }