fix regression from last commit (#20923)

This commit is contained in:
gemu 2024-03-11 08:22:10 +01:00 committed by GitHub
parent 79d02e772c
commit 190493c747
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -9640,12 +9640,12 @@ bool Script_SubCmd(void) {
if (cmdbuff) { if (cmdbuff) {
char *cp = cmdbuff; char *cp = cmdbuff;
*cp++ = '#'; *cp++ = '#';
strlcpy(cp, command, sizeof(cmdbuff) - 1); strlcpy(cp, command, 128 - 1);
uint8_t tlen = strlen(command); uint8_t tlen = strlen(command);
cp += tlen; cp += tlen;
if (XdrvMailbox.data_len > 0) { if (XdrvMailbox.data_len > 0) {
*cp++ = '('; *cp++ = '(';
uint32_t max_space = sizeof(cmdbuff) - tlen - 4; // 4 = #()0 uint32_t max_space = 128 - tlen - 4; // 4 = #()0
uint32_t max_len = min(XdrvMailbox.data_len, max_space); uint32_t max_len = min(XdrvMailbox.data_len, max_space);
strncpy(cp, XdrvMailbox.data, max_len); strncpy(cp, XdrvMailbox.data, max_len);
cp += max_len; cp += max_len;
@ -12064,7 +12064,7 @@ uint8_t msect = Run_Scripter1(">m", -2, 0);
} }
if (*lp!=';') { if (*lp!=';') {
// send this line to smtp // send this line to smtp
Replace_Cmd_Vars(lp, 1, tmp, sizeof(tmp)); Replace_Cmd_Vars(lp, 1, tmp, 256);
//client->println(tmp); //client->println(tmp);
func(tmp); func(tmp);
} }
@ -12107,7 +12107,7 @@ void ScriptJsonAppend(void) {
// subroutine // subroutine
lp = scripter_sub(lp + 1, 0); lp = scripter_sub(lp + 1, 0);
} else { } else {
Replace_Cmd_Vars(lp, 1, tmp, sizeof(tmp)); Replace_Cmd_Vars(lp, 1, tmp, 256);
ResponseAppend_P(PSTR("%s"), tmp); ResponseAppend_P(PSTR("%s"), tmp);
} }
} }