From ef63b21d99c23ca292dd0ad696fc09acbb2c1aa2 Mon Sep 17 00:00:00 2001 From: gemu2015 Date: Sat, 3 Oct 2020 18:30:18 +0200 Subject: [PATCH] fix scripter json decode crash --- tasmota/xdrv_10_scripter.ino | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tasmota/xdrv_10_scripter.ino b/tasmota/xdrv_10_scripter.ino index a3cba3385..40961770d 100755 --- a/tasmota/xdrv_10_scripter.ino +++ b/tasmota/xdrv_10_scripter.ino @@ -3708,6 +3708,7 @@ void esp32_beep(int32_t freq ,uint32_t len) { #define IF_NEST 8 // execute section of scripter int16_t Run_Scripter(const char *type, int8_t tlen, char *js) { +int16_t retval; if (!glob_script_mem.scriptptr) { return -99; @@ -3717,12 +3718,15 @@ int16_t Run_Scripter(const char *type, int8_t tlen, char *js) { JsonParserObject jo; if (js) { - String jss = js; // copy the string to a new buffer, not sure we can change the original buffer - JsonParser parser((char*)jss.c_str()); + //String jss = js; // copy the string to a new buffer, not sure we can change the original buffer + //JsonParser parser((char*)jss.c_str()); + JsonParser parser(js); jo = parser.getRootObject(); + retval = Run_script_sub(type, tlen, &jo); + } else { + retval = Run_script_sub(type, tlen, 0); } - - return Run_script_sub(type, tlen, &jo); + return retval; } int16_t Run_script_sub(const char *type, int8_t tlen, JsonParserObject *jo) {