Browse Source

drivers: w1: shell: fix off-by-one error

Prevent user to use and invalid setting index

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
pull/91789/head
Benjamin Cabé 3 weeks ago committed by Benjamin Cabé
parent
commit
bb3a898dec
  1. 2
      drivers/w1/w1_shell.c

2
drivers/w1/w1_shell.c

@ -317,7 +317,7 @@ static int cmd_w1_configure(const struct shell *sh, size_t argc, char **argv) @@ -317,7 +317,7 @@ static int cmd_w1_configure(const struct shell *sh, size_t argc, char **argv)
}
}
if (type > W1_SETINGS_TYPE_COUNT) {
if (type >= W1_SETINGS_TYPE_COUNT) {
shell_error(sh, "invalid type %u", type);
return -EINVAL;
}

Loading…
Cancel
Save