Message ID | 20240705075709.26809-3-r.smirnov@omp.ru (mailing list archive) |
---|---|
State | Accepted |
Commit | 85d98aecd6a9504cb51a4bd4f8b37cc11a0057f8 |
Headers | show |
Series | fix error found by SVACE static analyzer #2 | expand |
Context | Check | Description |
---|---|---|
tedd_an/pre-ci_am | success | Success |
tedd_an/CheckPatch | success | CheckPatch PASS |
tedd_an/GitLint | success | Gitlint PASS |
tedd_an/IncrementalBuild | success | Incremental Build PASS |
diff --git a/src/shared/shell.c b/src/shared/shell.c index add4fa131..48de8ab1b 100644 --- a/src/shared/shell.c +++ b/src/shared/shell.c @@ -1333,7 +1333,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);