Change in ...osmo-sip-connector[master]: coverity: Address issue found by coverity

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

keith gerrit-no-reply at lists.osmocom.org
Fri Aug 9 09:41:18 UTC 2019


keith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-sip-connector/+/15143


Change subject: coverity: Address issue found by coverity
......................................................................

coverity: Address issue found by coverity

Add NULL checks on the return value of call_leg_other() in
update_rtp()

If the remote side has requested media change and we cannot
find the other leg, then release call. This should not
happen.

Also, Add an assert to show that we cannot be here
without call type of SIP or MNCC (not related to coverity)

Change-Id: I6f1f26533a25c93f243090bc02f1bc83b9108d42
---
M src/mncc.c
1 file changed, 13 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-sip-connector refs/changes/43/15143/1

diff --git a/src/mncc.c b/src/mncc.c
index f5a44d5..7919c9b 100644
--- a/src/mncc.c
+++ b/src/mncc.c
@@ -211,10 +211,22 @@
 	if (_leg->type == CALL_TYPE_MNCC) {
 		leg = (struct mncc_call_leg *) _leg;
 		struct call_leg *other = call_leg_other(&leg->base);
+		if (!other) {
+			LOGP(DMNCC, LOGL_ERROR, "Failed to find other leg.");
+			_leg->release_call(_leg);
+			return;
+		}
 		send_rtp_connect(leg, other);
-	} else {
+	} else if (_leg->type == CALL_TYPE_SIP) {
 		leg = (struct mncc_call_leg *) call_leg_other(_leg);
+		if (!leg) {
+			LOGP(DMNCC, LOGL_ERROR, "Failed to find other leg.");
+			_leg->release_call(_leg);
+			return;
+		}
 		send_rtp_connect(leg, _leg);
+	} else {
+		OSMO_ASSERT(false);
 	}
 }
 

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-sip-connector/+/15143
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-sip-connector
Gerrit-Branch: master
Gerrit-Change-Id: I6f1f26533a25c93f243090bc02f1bc83b9108d42
Gerrit-Change-Number: 15143
Gerrit-PatchSet: 1
Gerrit-Owner: keith <keith at rhizomatica.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190809/71497b0c/attachment.htm>


More information about the gerrit-log mailing list