From c418758863c4fe0db71f032ddeb74367ea8e276a Mon Sep 17 00:00:00 2001 From: Raphael Coeffic Date: Mon, 6 Jun 2022 07:39:57 +0200 Subject: [PATCH] getGVarString: boundary check --- radio/src/strhelpers.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/radio/src/strhelpers.cpp b/radio/src/strhelpers.cpp index 068312638..b0ca2ee75 100644 --- a/radio/src/strhelpers.cpp +++ b/radio/src/strhelpers.cpp @@ -378,6 +378,11 @@ char *getGVarString(char *dest, int idx) idx = -idx - 1; } + if (idx >= MAX_GVARS) { + s[0] = '\0'; + return s; + } + if (g_model.gvars[idx].name[0]) strAppend(s, g_model.gvars[idx].name, LEN_GVAR_NAME); else