diff --git a/sonoff/_releasenotes.ino b/sonoff/_releasenotes.ino index f2cd88ad7..f3f07a15b 100644 --- a/sonoff/_releasenotes.ino +++ b/sonoff/_releasenotes.ino @@ -3,6 +3,7 @@ * Change uptime from hour to second resulting in a display of 123T13:45:21 where 123 is days * Fix Arilux RF induced exception by moving interrupt handler to iram on non esp/arduino lib v2.3.0 * Add NTP sync based on chip id (#1773) + * Fix regression from 5.11.1h web console and http input max length from 100 to 254 characters (#1819) * * 5.11.1i * Update TasmotaSerial library to 1.1.0 diff --git a/sonoff/sonoff.h b/sonoff/sonoff.h index 65462781a..7338772bd 100644 --- a/sonoff/sonoff.h +++ b/sonoff/sonoff.h @@ -82,7 +82,7 @@ typedef unsigned long power_t; // Power (Relay) type #define SERIALLOG_TIMER 600 // Seconds to disable SerialLog #define OTA_ATTEMPTS 5 // Number of times to try fetching the new firmware -#define INPUT_BUFFER_SIZE 250 // Max number of characters in (serial) command buffer +#define INPUT_BUFFER_SIZE 255 // Max number of characters in (serial) command buffer #define CMDSZ 24 // Max number of characters in command #define TOPSZ 100 // Max number of characters in topic string #define LOGSZ 400 // Max number of characters in log diff --git a/sonoff/sonoff.ino b/sonoff/sonoff.ino index 569b5dc85..204c83eeb 100644 --- a/sonoff/sonoff.ino +++ b/sonoff/sonoff.ino @@ -192,8 +192,8 @@ boolean mdns_begun = false; char my_version[33]; // Composed version string char my_hostname[33]; // Composed Wifi hostname -char mqtt_client[33]; // Composed MQTT Clientname -char serial_in_buffer[INPUT_BUFFER_SIZE + 2]; // Receive buffer +char mqtt_client[33]; // Composed MQTT Clientname +char serial_in_buffer[INPUT_BUFFER_SIZE]; // Receive buffer char mqtt_data[MESSZ]; // MQTT publish buffer and web page ajax buffer char log_data[LOGSZ]; // Logging char web_log[WEB_LOG_SIZE] = {'\0'}; // Web log buffer diff --git a/sonoff/webserver.ino b/sonoff/webserver.ino index 9af2d74be..0e1943325 100644 --- a/sonoff/webserver.ino +++ b/sonoff/webserver.ino @@ -1441,11 +1441,8 @@ void HandleHttpCommand() String message = F("{\"" D_RSLT_WARNING "\":\""); if (valid) { byte curridx = web_log_index; - char tmp[100]; - WebGetArg("cmnd", tmp, sizeof(tmp)); - if (strlen(tmp)) { -// snprintf_P(svalue, sizeof(svalue), tmp); // Processes FullTopic %p - strlcpy(svalue, tmp, sizeof(svalue)); // Fixed 5.8.0b + WebGetArg("cmnd", svalue, sizeof(svalue)); + if (strlen(svalue)) { // byte syslog_now = syslog_level; // syslog_level = 0; // Disable UDP syslog to not trigger hardware WDT - Seems to work fine since 5.7.1d (global logging) ExecuteCommand(svalue); @@ -1512,11 +1509,8 @@ void HandleAjaxConsoleRefresh() byte cflg = 1; byte counter = 0; // Initial start, should never be 0 again - char tmp[100]; - WebGetArg("c1", tmp, sizeof(tmp)); - if (strlen(tmp)) { -// snprintf_P(svalue, sizeof(svalue), tmp); // Processes FullTopic %p - strlcpy(svalue, tmp, sizeof(svalue)); // Fixed 5.8.0b + WebGetArg("c1", svalue, sizeof(svalue)); + if (strlen(svalue)) { snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_COMMAND "%s"), svalue); AddLog(LOG_LEVEL_INFO); // byte syslog_now = syslog_level; @@ -1525,9 +1519,9 @@ void HandleAjaxConsoleRefresh() // syslog_level = syslog_now; } - WebGetArg("c2", tmp, sizeof(tmp)); - if (strlen(tmp)) { - counter = atoi(tmp); + WebGetArg("c2", svalue, sizeof(svalue)); + if (strlen(svalue)) { + counter = atoi(svalue); } byte last_reset_web_log_flag = reset_web_log_flag; @@ -1596,7 +1590,6 @@ void HandleInformation() func += F(D_PROGRAM_VERSION "}2"); func += my_version; func += F("}1" D_BUILD_DATE_AND_TIME "}2"); func += GetBuildDateAndTime(); func += F("}1" D_CORE_AND_SDK_VERSION "}2" ARDUINO_ESP8266_RELEASE "/"); func += String(ESP.getSdkVersion()); -// func += F("}1" D_UPTIME "}2"); func += String(uptime); func += F(" Seconds"); func += F("}1" D_UPTIME "}2"); func += GetUptime(); snprintf_P(stopic, sizeof(stopic), PSTR(" at %X"), GetSettingsAddress()); func += F("}1" D_FLASH_WRITE_COUNT "}2"); func += String(Settings.save_flag); func += stopic;