fix: prevent hangs when processing long sensor names

This commit is contained in:
Yurii committed 2026-10-19 04:10:21 +03:00
1 parent 85dda5b859
commit f613731183
2 files changed
+2 -2

No files matched your search

+1 -1
View File
@@ -409,7 +409,7 @@ public:
static String& cleanName(String& value, char space = ' ') {
// only valid symbols
for (uint8_t pos = 0; pos < value.length(); pos++) {
for (size_t pos = 0; pos < value.length(); pos++) {
char symbol = value.charAt(pos);
// 0..9
+1 -1
View File
@@ -1885,7 +1885,7 @@ bool jsonToSensorSettings(const uint8_t sensorId, const JsonVariantConst src, Se
}
// name
if (!src[FPSTR(S_NAME)].isNull()) {
if (src[FPSTR(S_NAME)].is<JsonString>() && src[FPSTR(S_NAME)].as<JsonString>().size() < sizeof(dst.name)) {
auto value = src[FPSTR(S_NAME)].as<String>();
Sensors::cleanName(value);