From 733e272601dda3fe093ebca766afee1f2d11ce42 Mon Sep 17 00:00:00 2001 From: Peter Feerick Date: Mon, 10 Jan 2022 10:52:48 +1000 Subject: [PATCH] Revert "fix: Potential out of bounds access of flightmode name on main screen (#1337)" This reverts commit 1b6f827b2c1c782e4a8061a7c476775309865ee5. --- radio/src/gui/colorlcd/view_main_decoration.cpp | 4 ++-- radio/src/strhelpers.h | 6 ------ 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/radio/src/gui/colorlcd/view_main_decoration.cpp b/radio/src/gui/colorlcd/view_main_decoration.cpp index a156eb015..0066efef0 100644 --- a/radio/src/gui/colorlcd/view_main_decoration.cpp +++ b/radio/src/gui/colorlcd/view_main_decoration.cpp @@ -328,8 +328,8 @@ void ViewMainDecoration::createFlightMode() }; std::function getFM = []() -> std::string { - return stringFromNtString(g_model.flightModeData[mixerCurrentFlightMode].name); -}; + return g_model.flightModeData[mixerCurrentFlightMode].name; + }; flightMode = new DynamicText(this, r, getFM, CENTERED | COLOR_THEME_SECONDARY1); } diff --git a/radio/src/strhelpers.h b/radio/src/strhelpers.h index c7c08c86f..683de26d4 100644 --- a/radio/src/strhelpers.h +++ b/radio/src/strhelpers.h @@ -25,8 +25,6 @@ #include "definitions.h" #include "opentx_types.h" -#include - #define SHOW_TIME 0x1 #define SHOW_TIMER 0x0 #define SHOW_TIMER_UPPER_CASE 0x2 @@ -92,8 +90,4 @@ char *getTimerString(int32_t tme, TimerOptions timerOptions = {.options = 0}); void splitTimer(char *s0, char *s1, char *s2, char *s3, int tme, bool bLowercase = true); -template -constexpr std::string stringFromNtString(const char (&a)[N]) { - return std::string(a, strnlen(a, N)); -} #endif // _STRHELPERS_H_