Skip to content
Snippets Groups Projects
Commit 38a5f510 authored by Joshua Colp's avatar Joshua Colp
Browse files

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
parent 19916d11
No related branches found
No related tags found
No related merge requests found
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment