From bb3a898dec688c9f6f86de366c7497155ca20d2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Sat, 14 Jun 2025 21:02:02 +0200 Subject: [PATCH] drivers: w1: shell: fix off-by-one error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Prevent user to use and invalid setting index Signed-off-by: Benjamin Cabé --- drivers/w1/w1_shell.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/w1/w1_shell.c b/drivers/w1/w1_shell.c index aa0b06f2823..bd94c2a80b1 100644 --- a/drivers/w1/w1_shell.c +++ b/drivers/w1/w1_shell.c @@ -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; }