sig_analog: Fix SEGV due to calling strcmp on NULL.

Add an additional check to guard against the channel application being
NULL.

Resolves: #1380
This commit is contained in:
Naveen Albert
2025-08-18 10:02:38 -04:00
committed by github-actions[bot]
parent f0ac136a8b
commit 04ae0141b7

View File

@@ -3168,6 +3168,10 @@ static struct ast_frame *__analog_handle_event(struct analog_pvt *p, struct ast_
ast_debug(2, "Letting this call hang up normally, since it's not the only call\n");
} else if (!p->owner || !p->subs[ANALOG_SUB_REAL].owner || ast_channel_state(ast) != AST_STATE_UP) {
ast_debug(2, "Called Subscriber Held does not apply: channel state is %d\n", ast_channel_state(ast));
} else if (p->owner && p->subs[ANALOG_SUB_REAL].owner && ast_strlen_zero(ast_channel_appl(p->subs[ANALOG_SUB_REAL].owner))) {
/* If the channel application is empty, it is likely a masquerade has occured, in which case don't hold any calls.
* This conditional matches only executions that would have reached the strcmp below. */
ast_debug(1, "Skipping Called Subscriber Held; channel has no application\n");
} else if (!p->owner || !p->subs[ANALOG_SUB_REAL].owner || strcmp(ast_channel_appl(p->subs[ANALOG_SUB_REAL].owner), "AppDial")) {
/* Called Subscriber held only applies to incoming calls, not outgoing calls.
* We can't use p->outgoing because that is always true, for both incoming and outgoing calls, so it's not accurate.