mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-07-31 01:08:14 +00:00
fix: enforce upper bounds for rxdelay, txdelay, and direct.txdelay in CLI
This commit is contained in:
@@ -582,21 +582,21 @@ void CommonCLI::handleSetCmd(uint32_t sender_timestamp, char* command, char* rep
|
|||||||
strcpy(reply, "OK");
|
strcpy(reply, "OK");
|
||||||
} else if (memcmp(config, "rxdelay ", 8) == 0) {
|
} else if (memcmp(config, "rxdelay ", 8) == 0) {
|
||||||
float db = atof(&config[8]);
|
float db = atof(&config[8]);
|
||||||
if (db >= 0) {
|
if (db >= 0 && db <= 20.0f) {
|
||||||
_prefs->rx_delay_base = db;
|
_prefs->rx_delay_base = db;
|
||||||
savePrefs();
|
savePrefs();
|
||||||
strcpy(reply, "OK");
|
strcpy(reply, "OK");
|
||||||
} else {
|
} else {
|
||||||
strcpy(reply, "Error, cannot be negative");
|
strcpy(reply, "Error, must be 0-20");
|
||||||
}
|
}
|
||||||
} else if (memcmp(config, "txdelay ", 8) == 0) {
|
} else if (memcmp(config, "txdelay ", 8) == 0) {
|
||||||
float f = atof(&config[8]);
|
float f = atof(&config[8]);
|
||||||
if (f >= 0) {
|
if (f >= 0 && f <= 2.0f) {
|
||||||
_prefs->tx_delay_factor = f;
|
_prefs->tx_delay_factor = f;
|
||||||
savePrefs();
|
savePrefs();
|
||||||
strcpy(reply, "OK");
|
strcpy(reply, "OK");
|
||||||
} else {
|
} else {
|
||||||
strcpy(reply, "Error, cannot be negative");
|
strcpy(reply, "Error, must be 0-2");
|
||||||
}
|
}
|
||||||
} else if (memcmp(config, "flood.max ", 10) == 0) {
|
} else if (memcmp(config, "flood.max ", 10) == 0) {
|
||||||
uint8_t m = atoi(&config[10]);
|
uint8_t m = atoi(&config[10]);
|
||||||
@@ -609,12 +609,12 @@ void CommonCLI::handleSetCmd(uint32_t sender_timestamp, char* command, char* rep
|
|||||||
}
|
}
|
||||||
} else if (memcmp(config, "direct.txdelay ", 15) == 0) {
|
} else if (memcmp(config, "direct.txdelay ", 15) == 0) {
|
||||||
float f = atof(&config[15]);
|
float f = atof(&config[15]);
|
||||||
if (f >= 0) {
|
if (f >= 0 && f <= 2.0f) {
|
||||||
_prefs->direct_tx_delay_factor = f;
|
_prefs->direct_tx_delay_factor = f;
|
||||||
savePrefs();
|
savePrefs();
|
||||||
strcpy(reply, "OK");
|
strcpy(reply, "OK");
|
||||||
} else {
|
} else {
|
||||||
strcpy(reply, "Error, cannot be negative");
|
strcpy(reply, "Error, must be 0-2");
|
||||||
}
|
}
|
||||||
} else if (memcmp(config, "owner.info ", 11) == 0) {
|
} else if (memcmp(config, "owner.info ", 11) == 0) {
|
||||||
config += 11;
|
config += 11;
|
||||||
|
|||||||
Reference in New Issue
Block a user