mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-19 08:11:21 +00:00
Merge "pbx: Prevent execution of NULL pointer."
This commit is contained in:
12
main/pbx.c
12
main/pbx.c
@@ -2863,7 +2863,6 @@ static int pbx_extension_helper(struct ast_channel *c, struct ast_context *con,
|
|||||||
struct ast_exten *e;
|
struct ast_exten *e;
|
||||||
struct ast_app *app;
|
struct ast_app *app;
|
||||||
char *substitute = NULL;
|
char *substitute = NULL;
|
||||||
int res;
|
|
||||||
struct pbx_find_info q = { .stacklen = 0 }; /* the rest is reset in pbx_find_extension */
|
struct pbx_find_info q = { .stacklen = 0 }; /* the rest is reset in pbx_find_extension */
|
||||||
char passdata[EXT_DATA_SIZE];
|
char passdata[EXT_DATA_SIZE];
|
||||||
int matching_action = (action == E_MATCH || action == E_CANMATCH || action == E_MATCHMORE);
|
int matching_action = (action == E_MATCH || action == E_CANMATCH || action == E_MATCHMORE);
|
||||||
@@ -2880,9 +2879,12 @@ static int pbx_extension_helper(struct ast_channel *c, struct ast_context *con,
|
|||||||
ast_unlock_contexts();
|
ast_unlock_contexts();
|
||||||
return -1; /* success, we found it */
|
return -1; /* success, we found it */
|
||||||
} else if (action == E_FINDLABEL) { /* map the label to a priority */
|
} else if (action == E_FINDLABEL) { /* map the label to a priority */
|
||||||
res = e->priority;
|
int res = e->priority;
|
||||||
|
|
||||||
ast_unlock_contexts();
|
ast_unlock_contexts();
|
||||||
return res; /* the priority we were looking for */
|
|
||||||
|
/* the priority we were looking for */
|
||||||
|
return res;
|
||||||
} else { /* spawn */
|
} else { /* spawn */
|
||||||
if (!e->cached_app)
|
if (!e->cached_app)
|
||||||
e->cached_app = pbx_findapp(e->app);
|
e->cached_app = pbx_findapp(e->app);
|
||||||
@@ -2932,7 +2934,7 @@ static int pbx_extension_helper(struct ast_channel *c, struct ast_context *con,
|
|||||||
} else {
|
} else {
|
||||||
if (!q.swo->exec) {
|
if (!q.swo->exec) {
|
||||||
ast_log(LOG_WARNING, "No execution engine for switch %s\n", q.swo->name);
|
ast_log(LOG_WARNING, "No execution engine for switch %s\n", q.swo->name);
|
||||||
res = -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return q.swo->exec(c, q.foundcontext ? q.foundcontext : context, exten, priority, callerid, q.data);
|
return q.swo->exec(c, q.foundcontext ? q.foundcontext : context, exten, priority, callerid, q.data);
|
||||||
}
|
}
|
||||||
@@ -8922,7 +8924,7 @@ int ast_pbx_init(void)
|
|||||||
/* This is protected by the context_and_merge lock */
|
/* This is protected by the context_and_merge lock */
|
||||||
autohints = ao2_container_alloc_options(AO2_ALLOC_OPT_LOCK_NOLOCK, HASH_EXTENHINT_SIZE,
|
autohints = ao2_container_alloc_options(AO2_ALLOC_OPT_LOCK_NOLOCK, HASH_EXTENHINT_SIZE,
|
||||||
autohint_hash_cb, autohint_cmp);
|
autohint_hash_cb, autohint_cmp);
|
||||||
if (hintdevices) {
|
if (autohints) {
|
||||||
ao2_container_register("autohints", autohints, print_autohint_key);
|
ao2_container_register("autohints", autohints, print_autohint_key);
|
||||||
}
|
}
|
||||||
statecbs = ao2_container_alloc(1, NULL, statecbs_cmp);
|
statecbs = ao2_container_alloc(1, NULL, statecbs_cmp);
|
||||||
|
|||||||
Reference in New Issue
Block a user