[asterisk-commits] chan sip: when getting sip pvt return failure if not found (asterisk[master])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Sep 8 10:24:08 CDT 2017


Jenkins2 has submitted this change and it was merged. ( https://gerrit.asterisk.org/6450 )

Change subject: chan_sip: when getting sip pvt return failure if not found
......................................................................

chan_sip: when getting sip pvt return failure if not found

In handle_request_invite, when processing a pickup, a call
is made to get_sip_pvt_from_replaces to locate the pvt for
the subscription. The pvt is assumed to be valid when zero
is returned indicating no error, and is dereferenced which
can cause a crash if it was not found.

This change checks the not found case and returns -1 which
allows the calling code to fail appropriately.

ASTERISK-27217 #close
Reported-by: Bryan Walters

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

Approvals:
  Joshua Colp: Looks good to me, but someone else must approve
  Kevin Harwell: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, approved
  Jenkins2: Approved for Submit



diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index dcfadf4..0df9f72 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -18669,6 +18669,11 @@
 		}
 	}
 
+	if (!sip_pvt_ptr) {
+		/* return error if sip_pvt was not found */
+		return -1;
+	}
+
 	/* If we're here sip_pvt_ptr has been copied to *out_pvt, prevent RAII_VAR cleanup */
 	sip_pvt_ptr = NULL;
 

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

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I6bee92b8b8b85fcac3fd66f8c00ab18bc1765612
Gerrit-Change-Number: 6450
Gerrit-PatchSet: 1
Gerrit-Owner: Scott Griepentrog <scott at griepentrog.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Matthew Fredrickson <creslin at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-commits/attachments/20170908/0e44bc93/attachment-0001.html>


More information about the asterisk-commits mailing list