Skip to content

Commit 7413928

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

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
@@ -294,7 +294,7 @@ void CommonCLI::handleCommand(uint32_t sender_timestamp, const char* command, ch
294294
*/
295295
} else if (memcmp(command, "get ", 4) == 0) {
296296
const char* config = &command[4];
297-
if (memcmp(config, "dutycycle", 8) == 0) {
297+
if (memcmp(config, "dutycycle", 9) == 0) {
298298
float dc = 100.0f / (_prefs->airtime_factor + 1.0f);
299299
int dc_int = (int)dc;
300300
int dc_frac = (int)((dc - dc_int) * 10.0f + 0.5f);
@@ -456,8 +456,8 @@ void CommonCLI::handleCommand(uint32_t sender_timestamp, const char* command, ch
456456
*/
457457
} else if (memcmp(command, "set ", 4) == 0) {
458458
const char* config = &command[4];
459-
if (memcmp(config, "dutycycle ", 9) == 0) {
460-
float dc = atof(&config[9]);
459+
if (memcmp(config, "dutycycle ", 10) == 0) {
460+
float dc = atof(&config[10]);
461461
if (dc < 10 || dc > 100) {
462462
strcpy(reply, "ERROR: dutycycle must be 10-100");
463463
} else {

0 commit comments

Comments
 (0)