Skip to content

Commit 3c0d186

Browse files
Fix memcp compare length off by one
Co-authored-by: ViezeVingertjes <michael.overhorst@gmail.com>
1 parent f633843 commit 3c0d186

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/helpers/CommonCLI.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ void CommonCLI::handleCommand(uint32_t sender_timestamp, const char* command, ch
283283
*/
284284
} else if (memcmp(command, "get ", 4) == 0) {
285285
const char* config = &command[4];
286-
if (memcmp(config, "dutycycle", 8) == 0) {
286+
if (memcmp(config, "dutycycle", 9) == 0) {
287287
float dc = 100.0f / (_prefs->airtime_factor + 1.0f);
288288
int dc_int = (int)dc;
289289
int dc_frac = (int)((dc - dc_int) * 10.0f + 0.5f);
@@ -441,8 +441,8 @@ void CommonCLI::handleCommand(uint32_t sender_timestamp, const char* command, ch
441441
*/
442442
} else if (memcmp(command, "set ", 4) == 0) {
443443
const char* config = &command[4];
444-
if (memcmp(config, "dutycycle ", 9) == 0) {
445-
float dc = atof(&config[9]);
444+
if (memcmp(config, "dutycycle ", 10) == 0) {
445+
float dc = atof(&config[10]);
446446
if (dc < 10 || dc > 100) {
447447
strcpy(reply, "ERROR: dutycycle must be 10-100");
448448
} else {

0 commit comments

Comments
 (0)