diff --git a/radio/src/gui/colorlcd/model/model_mixer_scripts.cpp b/radio/src/gui/colorlcd/model/model_mixer_scripts.cpp index 7d57da68f..4cc7511e3 100644 --- a/radio/src/gui/colorlcd/model/model_mixer_scripts.cpp +++ b/radio/src/gui/colorlcd/model/model_mixer_scripts.cpp @@ -146,10 +146,8 @@ class ScriptEditWindow : public Page auto lbl = new DynamicText( line, rect_t{}, [=]() { - char s[16]; - getSourceString( - s, MIXSRC_FIRST_LUA + (idx * MAX_SCRIPT_OUTPUTS) + i); - return std::string(s, sizeof(s) - 1); + char* s = getSourceString(MIXSRC_FIRST_LUA + (idx * MAX_SCRIPT_OUTPUTS) + i); + return std::string(s); }); lbl->padLeft(PAD_LARGE); new DynamicNumber( diff --git a/radio/src/lua/interface.cpp b/radio/src/lua/interface.cpp index f988a1de1..eab40d0ed 100644 --- a/radio/src/lua/interface.cpp +++ b/radio/src/lua/interface.cpp @@ -168,12 +168,7 @@ void luaGetInputs(ScriptInputsOutputs & sid) case 0: luaL_checktype(lsScripts, -2, LUA_TNUMBER); // key is number luaL_checktype(lsScripts, -1, LUA_TSTRING); // value is string - { // To preserve the string value, truncate to 6 chars and move it to the main stack - char str[7] = {0}; - strncpy(str, lua_tostring(lsScripts, -1), 6); - lua_pushstring(mainState, &str[0]); - } - lua_pop(lsScripts, 1); + lua_xmove(lsScripts, mainState, 1); // To preserve the string value, move it to the main stack lua_pushnil(lsScripts); // Keep the stack balanced lua_insert(mainState, -2); // Keep the coroutine at the top of the main stack si->name = lua_tostring(mainState, -2);