mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-03 03:20:57 +00:00
CLI: Address multiple issues.
* listen uses the variable `s` for the result from ast_poll() then overwrites it with the result of accept(). Create a separate variable poll_result to avoid confusion since ast_poll does not return a file descriptor. * Resolve fd leak that would occur if setsockopt failed in listen. * Reserve an extra byte while processing completion results from remote daemon. This fixes a bug where completion processing used strstr() on a string that was not '\0' terminated. This was no risk to the Asterisk daemon, the bug was only reachable the remote console process. * Resolve leak in handle_showchan when the channel is not found. * Multiple leaks and a deadlock in pbx_config CLI completion. * Fix leaks in "manager show command". Change-Id: I8f633ceb1714867ae30ef4e421858f77c14485a9
This commit is contained in:
@@ -322,8 +322,10 @@ static char *complete_dialplan_remove_include(struct ast_cli_args *a)
|
||||
while ( (nc = ast_walk_contexts(nc)) && nc != c && !already_served)
|
||||
already_served = lookup_ci(nc, i_name);
|
||||
|
||||
if (!already_served && ++which > a->n)
|
||||
if (!already_served && ++which > a->n) {
|
||||
res = ast_strdup(i_name);
|
||||
break;
|
||||
}
|
||||
}
|
||||
ast_unlock_context(c);
|
||||
}
|
||||
@@ -1549,17 +1551,21 @@ static char *complete_dialplan_remove_ignorepat(struct ast_cli_args *a)
|
||||
}
|
||||
|
||||
for (c = NULL; !ret && (c = ast_walk_contexts(c)); ) {
|
||||
if (ast_rdlock_context(c)) /* fail, skip it */
|
||||
if (ast_rdlock_context(c)) {
|
||||
/* fail, skip it */
|
||||
continue;
|
||||
if (!partial_match(ast_get_context_name(c), a->word, len))
|
||||
}
|
||||
if (!partial_match(ast_get_context_name(c), a->word, len)) {
|
||||
ast_unlock_context(c);
|
||||
continue;
|
||||
}
|
||||
if (lookup_c_ip(c, ignorepat) && ++which > a->n)
|
||||
ret = ast_strdup(ast_get_context_name(c));
|
||||
ast_unlock_context(c);
|
||||
}
|
||||
ast_unlock_contexts();
|
||||
ast_free(dupline);
|
||||
return NULL;
|
||||
return ret;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
Reference in New Issue
Block a user