Diff between 0fda2dd545fc0c2d879db729ab3be22e88be7072 and 85d98aecd6a9504cb51a4bd4f8b37cc11a0057f8

Changed Files

File Additions Deletions Status
src/shared/shell.c +1 -1 modified

Full Patch

diff --git a/src/shared/shell.c b/src/shared/shell.c
index 73caa77..88ecaa0 100644
--- a/src/shared/shell.c
+++ b/src/shared/shell.c
@@ -1334,7 +1334,7 @@ void bt_shell_init(int argc, char **argv, const struct bt_shell_opt *opt)
 				}
 			}
 
-			if (opt) {
+			if (opt && index >= 0 && (size_t)index >= offset) {
 				if (c != opt->options[index - offset].val) {
 					usage(argc, argv, opt);
 					exit(EXIT_SUCCESS);