mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-16 23:08:32 +00:00
Fix dialplan function NULL channel safety issues
(closes issue ASTERISK-23391) Reported by: Corey Farrell Review: https://reviewboard.asterisk.org/r/3386/ ........ Merged revisions 411313 from http://svn.asterisk.org/svn/asterisk/branches/1.8 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@411314 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -96,20 +96,23 @@ static int isexten_function_read(struct ast_channel *chan, const char *cmd, char
|
||||
int priority_num;
|
||||
if (sscanf(args.priority, "%30d", &priority_num) == 1 && priority_num > 0) {
|
||||
int res;
|
||||
res = ast_exists_extension(chan, args.context, args.exten, priority_num,
|
||||
res = ast_exists_extension(chan, args.context, args.exten, priority_num,
|
||||
!chan ? NULL :
|
||||
S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL));
|
||||
if (res)
|
||||
strcpy(buf, "1");
|
||||
} else {
|
||||
int res;
|
||||
res = ast_findlabel_extension(chan, args.context, args.exten, args.priority,
|
||||
!chan ? NULL :
|
||||
S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL));
|
||||
if (res > 0)
|
||||
strcpy(buf, "1");
|
||||
}
|
||||
} else if (!ast_strlen_zero(args.exten)) {
|
||||
int res;
|
||||
res = ast_exists_extension(chan, args.context, args.exten, 1,
|
||||
res = ast_exists_extension(chan, args.context, args.exten, 1,
|
||||
!chan ? NULL :
|
||||
S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL));
|
||||
if (res)
|
||||
strcpy(buf, "1");
|
||||
@@ -133,6 +136,11 @@ static int acf_isexten_exec(struct ast_channel *chan, const char *cmd, char *par
|
||||
AST_APP_ARG(priority);
|
||||
);
|
||||
|
||||
if (!chan) {
|
||||
ast_log(LOG_WARNING, "No channel was provided to %s function.\n", cmd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
AST_STANDARD_APP_ARGS(args, parse);
|
||||
|
||||
if (ast_strlen_zero(args.context)) {
|
||||
|
||||
Reference in New Issue
Block a user