From 38a5f5100674e2d9a288549c58443e92d5b49ab4 Mon Sep 17 00:00:00 2001 From: Joshua Colp Date: Wed, 6 May 2009 14:35:47 +0000 Subject: [PATCH] Fix an infinite loop with tab completion of CLI aliases that reference themselves. (closes issue #15020) Reported by: junky git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@192700 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- res/res_clialiases.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/res/res_clialiases.c b/res/res_clialiases.c index 156212f..d7e38bb 100644 --- a/res/res_clialiases.c +++ b/res/res_clialiases.c @@ -98,7 +98,9 @@ static char *cli_alias_passthrough(struct ast_cli_entry *e, int cmd, struct ast_ case CLI_GENERATE: line = a->line; line += (strlen(alias->alias)); - if (!ast_strlen_zero(a->word)) { + if (!strncmp(alias->alias, alias->real_cmd, strlen(alias->alias))) { + generator = NULL; + } else if (!ast_strlen_zero(a->word)) { struct ast_str *real_cmd = ast_str_alloca(strlen(alias->real_cmd) + strlen(line) + 1); ast_str_append(&real_cmd, 0, "%s%s", alias->real_cmd, line); generator = ast_cli_generator(ast_str_buffer(real_cmd), a->word, a->n); -- 1.7.9.5