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

Matt Jordan asteriskteam at digium.com
Wed Dec 9 12:40:48 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:
  Kevin Harwell: Looks good to me, but someone else must approve
  Richard Mudgett: Looks good to me, but someone else must approve
  Anonymous Coward #1000019: Verified
  Matt Jordan: Looks good to me, approved



diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index b42e625..7f22beb 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -4772,6 +4772,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/1791
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ifaa707c04b865a290ffab719bd2e5c48ff667c7b
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 11
Gerrit-Owner: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
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