diff --git a/source/shell/buzzer.c b/source/shell/buzzer.c index 0c1d388..bc04f9c 100644 --- a/source/shell/buzzer.c +++ b/source/shell/buzzer.c @@ -26,7 +26,7 @@ int shell_buzzer(struct console *con, size_t argc, const char **argv) fprintf(con->fp, "%u %d %u\n", buzzer_id, state, freq); - if (buzzer_id > nbuzzers) { + if (buzzer_id >= nbuzzers) { fprintf(con->fp, "error: invalid buzzer ID %d\n", buzzer_id); return -1; } diff --git a/source/shell/led.c b/source/shell/led.c index 529ac76..df1cb50 100644 --- a/source/shell/led.c +++ b/source/shell/led.c @@ -21,7 +21,7 @@ int shell_led(struct console *con, size_t argc, const char **argv) if (argc >= 1) led_id = strtoul(argv[0], NULL, 0); - if (led_id > nleds) { + if (led_id >= nleds) { fprintf(con->fp, "error: unknown LED ID %d\n", led_id); return -1; }