From 8d0edf2b3714bd1096902d15d240c2a43c270bd5 Mon Sep 17 00:00:00 2001 From: Sean Bright Date: Wed, 25 Sep 2019 12:01:33 -0400 Subject: [PATCH] pbx: Prevent Realtime switch crash on invalid priority pbx_extension_helper takes two 'context' arguments. One (con) is a pointer directly to a 'struct ast_context' and the other (context) is the name of the context. In all cases, one of these arguments is NULL and the other is non-NULL. Functions that are ultimately called by pbx_extension_helper expect that 'context' will be non-NULL, so we set it unconditionally on entry into this function. ASTERISK-28534 #close Change-Id: Ifbbc5e71440afd80efd441f7a9d72e8b10b6f47d --- main/pbx.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/main/pbx.c b/main/pbx.c index 83bfb9036c..8b869f162c 100644 --- a/main/pbx.c +++ b/main/pbx.c @@ -2884,6 +2884,11 @@ static int pbx_extension_helper(struct ast_channel *c, struct ast_context *con, int matching_action = (action == E_MATCH || action == E_CANMATCH || action == E_MATCHMORE); ast_rdlock_contexts(); + + if (!context) { + context = con->name; + } + if (found) *found = 0;