mirror of
https://github.com/Laxilef/OTGateway.git
synced 2026-11-11 08:54:51 +05:00
fix: prevent hangs when processing long sensor names
This commit is contained in:
1 parent
85dda5b859
commit
f613731183
2 files changed
+2
-2
No files matched your search
+1
-1
@@ -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
@@ -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);
|
||||
|
||||
|
||||
Reference in new issue
Block a user