From 799a9eb388c5418da37c327fc7316e4c423b8913 Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Fri, 23 Feb 2018 10:58:51 +0200 Subject: [PATCH] shared/shell: Fix not reseting optind Not reseting optind may crash the tool if getopt and variants are called a second time. --- src/shared/shell.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/shared/shell.c b/src/shared/shell.c index b57ae1b57..5e9e5eac8 100644 --- a/src/shared/shell.c +++ b/src/shared/shell.c @@ -829,6 +829,7 @@ void bt_shell_init(int argc, char **argv, const struct bt_shell_opt *opt) data.argc = argc - optind; data.argv = argv + optind; + optind = 0; data.mode = (data.argc > 0); if (data.mode) -- 2.47.3