all_cmd arrays is not terminated by zeroed element.
---
tools/btmgmt.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/tools/btmgmt.c b/tools/btmgmt.c
index 15425fb..75f64c2 100644
--- a/tools/btmgmt.c
+++ b/tools/btmgmt.c
@@ -3406,9 +3406,9 @@ static char **cmd_completion(const char *text, int start, int end)
char **matches = NULL;
if (start > 0) {
- int i;
+ unsigned int i;
- for (i = 0; all_cmd[i].cmd; i++) {
+ for (i = 0; i < NELEM(all_cmd); i++) {
struct cmd_info *c = &all_cmd[i];
if (strncmp(c->cmd, rl_line_buffer, start - 1))
@@ -3519,7 +3519,7 @@ done:
static void usage(void)
{
- int i;
+ unsigned int i;
printf("btmgmt ver %s\n", VERSION);
printf("Usage:\n"
@@ -3531,7 +3531,7 @@ static void usage(void)
"\t--help\tDisplay help\n");
printf("Commands:\n");
- for (i = 0; all_cmd[i].cmd; i++)
+ for (i = 0; i < NELEM(all_cmd); i++)
printf("\t%-15s\t%s\n", all_cmd[i].cmd, all_cmd[i].doc);
printf("\n"
--
2.1.4
Hi Szymon,
On Thu, Feb 12, 2015, Szymon Janc wrote:
> all_cmd arrays is not terminated by zeroed element.
> ---
> tools/btmgmt.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
Applied. Thanks.
Johan