Skip to content

Commit bb3a898

Browse files
committed
drivers: w1: shell: fix off-by-one error
Prevent user to use and invalid setting index Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
1 parent d048806 commit bb3a898

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/w1/w1_shell.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ static int cmd_w1_configure(const struct shell *sh, size_t argc, char **argv)
317317
}
318318
}
319319

320-
if (type > W1_SETINGS_TYPE_COUNT) {
320+
if (type >= W1_SETINGS_TYPE_COUNT) {
321321
shell_error(sh, "invalid type %u", type);
322322
return -EINVAL;
323323
}

0 commit comments

Comments
 (0)