mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-24 22:58:21 +00:00
Add some safety measures when using gosub, especially when using the options
for app_dial and app_queue to run a gosub when the call is answered. * Check for the existence of the gosub target in gosub_exec. If it is nonexistent, then this will cause errors when we attempt to actually run the gosub, including a definite memory leak and potential crashes. Return an error in this situation * Check the return value of pbx_exec in app_dial and app_queue before attempting to actually run the gosub routine. If there was an error, we should not attempt to run the gosub. * Change a '|' to a ',' in app_queue. * Add some extra curly braces where they had been missing previously. (closes issue #13548) Reported by: fiddur git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@160626 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -3982,7 +3982,7 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
|
||||
ast_log(LOG_WARNING, "asprintf() failed: %s\n", strerror(errno));
|
||||
gosub_args = NULL;
|
||||
}
|
||||
*gosub_argstart = '|';
|
||||
*gosub_argstart = ',';
|
||||
} else {
|
||||
if (asprintf(&gosub_args, "%s,s,1", gosubexec) < 0) {
|
||||
ast_log(LOG_WARNING, "asprintf() failed: %s\n", strerror(errno));
|
||||
@@ -3991,13 +3991,14 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
|
||||
}
|
||||
if (gosub_args) {
|
||||
res = pbx_exec(peer, application, gosub_args);
|
||||
ast_pbx_run(peer);
|
||||
if (!res) {
|
||||
ast_pbx_run(peer);
|
||||
}
|
||||
free(gosub_args);
|
||||
ast_debug(1, "Gosub exited with status %d\n", res);
|
||||
} else
|
||||
} else {
|
||||
ast_log(LOG_ERROR, "Could not Allocate string for Gosub arguments -- Gosub Call Aborted!\n");
|
||||
|
||||
res = 0;
|
||||
}
|
||||
} else {
|
||||
ast_log(LOG_ERROR, "Could not find application Gosub\n");
|
||||
res = -1;
|
||||
|
Reference in New Issue
Block a user