mirror of
https://github.com/Laxilef/OTGateway.git
synced 2026-11-30 10:13:04 +05:00
fix: reject wildcards in MQTT prefix
This commit is contained in:
1 parent
6eb1ef6ae7
commit
e6646bb25a
1 file changed
+1
-1
+1
-1
@@ -1289,7 +1289,7 @@ SettingResult fromJson(JsonVariantConst src, MqttSettings& dst) {
|
|||||||
const JsonString value = src[S_PREFIX].as<JsonString>();
|
const JsonString value = src[S_PREFIX].as<JsonString>();
|
||||||
|
|
||||||
if (strlen(value.c_str()) == value.size()) {
|
if (strlen(value.c_str()) == value.size()) {
|
||||||
if (value.size() && value.size() < sizeof(dst.prefix)) {
|
if (value.size() && value.size() < sizeof(dst.prefix) && strpbrk(value.c_str(), "+#") == nullptr) {
|
||||||
result.accepted = true;
|
result.accepted = true;
|
||||||
if (strcmp(value.c_str(), dst.prefix) != 0) {
|
if (strcmp(value.c_str(), dst.prefix) != 0) {
|
||||||
strcpy(dst.prefix, value.c_str());
|
strcpy(dst.prefix, value.c_str());
|
||||||
|
|||||||
Reference in new issue
Block a user