From d6764ca0f83c03557e2f73189a7ba61768048055 Mon Sep 17 00:00:00 2001 From: Raphael Coeffic Date: Tue, 20 Sep 2022 08:05:34 +0200 Subject: [PATCH] fix: prevent out of bounds access if g_eeGeneral.templateSetup has an invalid value --- radio/src/opentx.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/radio/src/opentx.cpp b/radio/src/opentx.cpp index d6d2cd247..897da4f0c 100644 --- a/radio/src/opentx.cpp +++ b/radio/src/opentx.cpp @@ -69,6 +69,7 @@ const uint8_t bchout_ar[] = { uint8_t channelOrder(uint8_t setup, uint8_t x) { + if (setup >= sizeof(bchout_ar)) return x; return ((*(bchout_ar + setup) >> (6 - (x - 1) * 2)) & 3) + 1; }