diff --git a/README.md b/README.md index e00731177..eddbb9413 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ ## Sonoff-Tasmota Provide ESP8266 based Sonoff by [iTead Studio](https://www.itead.cc/) and ElectroDragon IoT Relay with Serial, Web and MQTT control allowing 'Over the Air' or OTA firmware updates using Arduino IDE. -Current version is **5.6.1k** - See [sonoff/_releasenotes.ino](https://github.com/arendst/Sonoff-Tasmota/blob/development/sonoff/_releasenotes.ino) for change information. +Current version is **5.6.1l** - See [sonoff/_releasenotes.ino](https://github.com/arendst/Sonoff-Tasmota/blob/development/sonoff/_releasenotes.ino) for change information. ### ATTENTION All versions diff --git a/sonoff/_releasenotes.ino b/sonoff/_releasenotes.ino index 57183d6f0..27dad4200 100644 --- a/sonoff/_releasenotes.ino +++ b/sonoff/_releasenotes.ino @@ -1,4 +1,9 @@ -/* 5.6.1k +/* 5.6.1l + * Fix some string length issues + * Add more string length tests by using strncpy + * Tried to fix Exception 3 as I can't reproduce (#830) + * + * 5.6.1k * Fix preprocessor language selection * * 5.6.1j diff --git a/sonoff/sonoff.ino b/sonoff/sonoff.ino index 0a311ea37..a3245227f 100644 --- a/sonoff/sonoff.ino +++ b/sonoff/sonoff.ino @@ -25,7 +25,7 @@ - Select IDE Tools - Flash Size: "1M (no SPIFFS)" ====================================================*/ -#define VERSION 0x0506010B // 5.6.1k +#define VERSION 0x0506010C // 5.6.1l enum log_t {LOG_LEVEL_NONE, LOG_LEVEL_ERROR, LOG_LEVEL_INFO, LOG_LEVEL_DEBUG, LOG_LEVEL_DEBUG_MORE, LOG_LEVEL_ALL}; enum week_t {Last, First, Second, Third, Fourth}; @@ -544,7 +544,7 @@ void mqtt_publishPowerBlinkState(byte device) void mqtt_connected() { char stopic[TOPSZ]; - char svalue[128]; // was MESSZ + char svalue[164]; // was MESSZ if (sysCfg.flag.mqtt_enabled) { diff --git a/sonoff/support.ino b/sonoff/support.ino index 44cbaf0ce..dd15ccea4 100644 --- a/sonoff/support.ino +++ b/sonoff/support.ino @@ -69,7 +69,7 @@ String getResetReason() { char buff[32]; if (osw_flag) { - strcpy_P(buff, PSTR(D_BLOCKED_LOOP)); + strncpy_P(buff, PSTR(D_BLOCKED_LOOP), sizeof(buff)); return String(buff); } else { return ESP.getResetReason(); @@ -151,11 +151,11 @@ char* _dtostrf(double number, unsigned char prec, char *s, bool i18n) bool negative = false; if (isnan(number)) { - strcpy(s, "nan"); + strcpy_P(s, PSTR("nan")); return s; } if (isinf(number)) { - strcpy(s, "inf"); + strcpy_P(s, PSTR("inf")); return s; } char decimal = '.'; diff --git a/sonoff/webserver.ino b/sonoff/webserver.ino index c12da3973..b1a65feb0 100644 --- a/sonoff/webserver.ino +++ b/sonoff/webserver.ino @@ -433,7 +433,7 @@ void handleRoot() } else { char stemp[10], line[160]; String page = FPSTR(HTTP_HEAD); - page.replace(F("{v}"), S_MAIN_MENU); + page.replace(F("{v}"), FPSTR(S_MAIN_MENU)); page.replace(F("
"), F("")); page += F(""); @@ -592,7 +592,7 @@ void handleConfig() addLog_P(LOG_LEVEL_DEBUG, S_LOG_HTTP, S_CONFIGURATION); String page = FPSTR(HTTP_HEAD); - page.replace(F("{v}"), S_CONFIGURATION); + page.replace(F("{v}"), FPSTR(S_CONFIGURATION)); page += FPSTR(HTTP_BTN_MENU2); if (sysCfg.flag.mqtt_enabled) { page += FPSTR(HTTP_BTN_MENU3); @@ -656,7 +656,7 @@ void handleModule() addLog_P(LOG_LEVEL_DEBUG, S_LOG_HTTP, S_CONFIGURE_MODULE); String page = FPSTR(HTTP_HEAD); - page.replace(F("{v}"), S_CONFIGURE_MODULE); + page.replace(F("{v}"), FPSTR(S_CONFIGURE_MODULE)); page += FPSTR(HTTP_FORM_MODULE); snprintf_P(stemp, sizeof(stemp), modules[MODULE].name); page.replace(F("{mt}"), stemp); @@ -720,7 +720,7 @@ void handleWifi(boolean scan) addLog_P(LOG_LEVEL_DEBUG, S_LOG_HTTP, S_CONFIGURE_WIFI); String page = FPSTR(HTTP_HEAD); - page.replace(F("{v}"), S_CONFIGURE_WIFI); + page.replace(F("{v}"), FPSTR(S_CONFIGURE_WIFI)); if (scan) { #ifdef USE_EMULATION @@ -731,7 +731,7 @@ void handleWifi(boolean scan) if (0 == n) { addLog_P(LOG_LEVEL_DEBUG, S_LOG_WIFI, S_NO_NETWORKS_FOUND); - page += S_NO_NETWORKS_FOUND; + page += FPSTR(S_NO_NETWORKS_FOUND); page += F(". " D_REFRESH_TO_SCAN_AGAIN "."); } else { //sort networks @@ -820,7 +820,7 @@ void handleMqtt() addLog_P(LOG_LEVEL_DEBUG, S_LOG_HTTP, S_CONFIGURE_MQTT); String page = FPSTR(HTTP_HEAD); - page.replace(F("{v}"), S_CONFIGURE_MQTT); + page.replace(F("{v}"), FPSTR(S_CONFIGURE_MQTT)); page += FPSTR(HTTP_FORM_MQTT); char str[sizeof(sysCfg.mqtt_client)]; getClient(str, MQTT_CLIENT_ID, sizeof(sysCfg.mqtt_client)); @@ -845,7 +845,7 @@ void handleLog() addLog_P(LOG_LEVEL_DEBUG, S_LOG_HTTP, S_CONFIGURE_LOGGING); String page = FPSTR(HTTP_HEAD); - page.replace(F("{v}"), S_CONFIGURE_LOGGING); + page.replace(F("{v}"), FPSTR(S_CONFIGURE_LOGGING)); page += FPSTR(HTTP_FORM_LOG1); for (byte idx = 0; idx < 3; idx++) { page += FPSTR(HTTP_FORM_LOG2); @@ -894,7 +894,7 @@ void handleOther() char stemp[40]; String page = FPSTR(HTTP_HEAD); - page.replace(F("{v}"), S_CONFIGURE_OTHER); + page.replace(F("{v}"), FPSTR(S_CONFIGURE_OTHER)); page += FPSTR(HTTP_FORM_OTHER); page.replace(F("{p1}"), sysCfg.web_password); page.replace(F("{r1}"), (sysCfg.flag.mqtt_enabled) ? F(" checked") : F("")); @@ -1064,7 +1064,7 @@ void handleSave() restart = (!strlen(webServer->arg("r").c_str())) ? 1 : atoi(webServer->arg("r").c_str()); if (restart) { String page = FPSTR(HTTP_HEAD); - page.replace(F("{v}"), S_SAVE_CONFIGURATION); + page.replace(F("{v}"), FPSTR(S_SAVE_CONFIGURATION)); page += F("