[Asterisk-code-review] chan sip: Check sip pvt pointer in ast channel get t38 state(c) (asterisk[master])

Matt Jordan asteriskteam at digium.com
Wed Dec 9 12:40:58 CST 2015


Matt Jordan has submitted this change and it was merged.

Change subject: chan_sip: Check sip_pvt pointer in ast_channel_get_t38_state(c)
......................................................................


chan_sip: Check sip_pvt pointer in ast_channel_get_t38_state(c)

Asterisk may crash when calling ast_channel_get_t38_state(c)
on a locked channel which is being hung up.

ASTERISK-25609 #close

Change-Id: Ifaa707c04b865a290ffab719bd2e5c48ff667c7b
---
M channels/chan_sip.c
1 file changed, 5 insertions(+), 0 deletions(-)

Approvals:
  Richard Mudgett: Looks good to me, but someone else must approve
  Anonymous Coward #1000019: Verified
  Matt Jordan: Looks good to me, approved
  Joshua Colp: Looks good to me, but someone else must approve



diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index b2d6112..cd03e15 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -4757,6 +4757,11 @@
 	struct sip_pvt *p = (struct sip_pvt *) ast_channel_tech_pvt(chan);
 	char *cp;
 
+	if (!p) {
+		ast_debug(1, "Attempt to Ref a null pointer. Sip private structure is gone!\n");
+		return -1;
+	}
+
 	sip_pvt_lock(p);
 
 	switch (option) {

-- 
To view, visit https://gerrit.asterisk.org/1776
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ifaa707c04b865a290ffab719bd2e5c48ff667c7b
Gerrit-PatchSet: 2
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Filip Jenicek <phill at janevim.cz>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Filip Jenicek <phill at janevim.cz>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>



More information about the asterisk-code-review mailing list