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

Prevent user to use and invalid setting index

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
This commit is contained in:
Benjamin Cabé 2025-06-14 21:02:02 +02:00 committed by Benjamin Cabé
commit bb3a898dec

View file

@ -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;
}