[Asterisk-code-review] app confbridge: Fix NULL check in action kick last. (asterisk[master])
Joshua Colp
asteriskteam at digium.com
Wed Jan 10 09:08:28 CST 2018
Joshua Colp has submitted this change and it was merged. ( https://gerrit.asterisk.org/7877 )
Change subject: app_confbridge: Fix NULL check in action_kick_last.
......................................................................
app_confbridge: Fix NULL check in action_kick_last.
The check for last_user == NULL needs to happen before we dereference
the variable, previously it was possible for us to check flags of a NULL
last_user.
Change-Id: I274f737aa8af9d2d53e4a78cdd7ad57561003945
---
M apps/app_confbridge.c
1 file changed, 9 insertions(+), 3 deletions(-)
Approvals:
Joshua Colp: Looks good to me, but someone else must approve; Approved for Submit
Richard Mudgett: Looks good to me, but someone else must approve
George Joseph: Looks good to me, approved
diff --git a/apps/app_confbridge.c b/apps/app_confbridge.c
index 73dff86..f972e38 100644
--- a/apps/app_confbridge.c
+++ b/apps/app_confbridge.c
@@ -2689,17 +2689,23 @@
}
ao2_lock(conference);
- if (((last_user = AST_LIST_LAST(&conference->active_list)) == user)
- || (ast_test_flag(&last_user->u_profile, USER_OPT_ADMIN))) {
+ last_user = AST_LIST_LAST(&conference->active_list);
+ if (!last_user) {
+ ao2_unlock(conference);
+ return 0;
+ }
+
+ if (last_user == user || ast_test_flag(&last_user->u_profile, USER_OPT_ADMIN)) {
ao2_unlock(conference);
play_file(bridge_channel, NULL,
conf_get_sound(CONF_SOUND_ERROR_MENU, conference->b_profile.sounds));
- } else if (last_user && !last_user->kicked) {
+ } else if (!last_user->kicked) {
last_user->kicked = 1;
pbx_builtin_setvar_helper(last_user->chan, "CONFBRIDGE_RESULT", "KICKED");
ast_bridge_remove(conference->bridge, last_user->chan);
ao2_unlock(conference);
}
+
return 0;
}
--
To view, visit https://gerrit.asterisk.org/7877
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I274f737aa8af9d2d53e4a78cdd7ad57561003945
Gerrit-Change-Number: 7877
Gerrit-PatchSet: 1
Gerrit-Owner: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180110/726d3756/attachment.html>
More information about the asterisk-code-review
mailing list