mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-11-02 10:51:57 +00:00
Validate set af input to prevent out-of-range airtime factors
This commit is contained in:
@@ -67,8 +67,14 @@ bool CommonRadioPrefs::handleCommand(const char* command, uint32_t sender_timest
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (memcmp(command, "set af ", 7) == 0) {
|
if (memcmp(command, "set af ", 7) == 0) {
|
||||||
setAirtimeFactor(atof(&command[7]));
|
char* end;
|
||||||
strcpy(reply, "OK");
|
float af = strtof(&command[7], &end);
|
||||||
|
if (end == &command[7] || af < 0 || af > 9) {
|
||||||
|
strcpy(reply, "ERROR: af must be 0-9");
|
||||||
|
} else {
|
||||||
|
setAirtimeFactor(af);
|
||||||
|
strcpy(reply, "OK");
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user