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.orgkeith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-sip-connector/+/15079
Change subject: In hold/retreive/reinvite, add check that other_leg exists
......................................................................
In hold/retreive/reinvite, add check that other_leg exists
We should always check that the other leg did not somehow
dissapear before accessing it.
Change-Id: I947aab6c0cc5019929bde1c7012e1a8c3d3472a5
---
M src/mncc.c
M src/sip.c
2 files changed, 31 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-sip-connector refs/changes/79/15079/1
diff --git a/src/mncc.c b/src/mncc.c
index 90eddc1..744e0ea 100644
--- a/src/mncc.c
+++ b/src/mncc.c
@@ -703,6 +703,12 @@
LOGP(DMNCC, LOGL_DEBUG,
"leg(%u) is requesting hold.\n", leg->callref);
other_leg = call_leg_other(&leg->base);
+ if (!other_leg) {
+ LOGP(DMNCC, LOGL_ERROR, "leg(%u) other leg gone!\n",
+ leg->callref);
+ mncc_send(leg->conn, MNCC_HOLD_REJ, leg->callref);
+ return;
+ }
other_leg->hold_call(other_leg);
mncc_send(leg->conn, MNCC_HOLD_CNF, leg->callref);
leg->state = MNCC_CC_HOLD;
@@ -721,6 +727,14 @@
LOGP(DMNCC, LOGL_DEBUG,
"leg(%u) is requesting unhold.\n", leg->callref);
other_leg = call_leg_other(&leg->base);
+ if (!other_leg) {
+ /* The SIP leg went away while we were holding! */
+ LOGP(DMNCC, LOGL_ERROR, "leg(%u) other leg gone!\n",
+ leg->callref);
+ mncc_send(leg->conn, MNCC_RETRIEVE_CNF, leg->callref);
+ mncc_call_leg_release(&leg->base);
+ return;
+ }
other_leg->retrieve_call(other_leg);
mncc_send(leg->conn, MNCC_RETRIEVE_CNF, leg->callref);
/* In case of call waiting/swap, At this point we need to tell the MSC to send
diff --git a/src/sip.c b/src/sip.c
index c1e34d3..13bb183 100644
--- a/src/sip.c
+++ b/src/sip.c
@@ -193,6 +193,13 @@
LOGP(DSIP, LOGL_NOTICE, "re-INVITE for call %s\n", sip->sip_call_id->i_id);
struct call_leg *other = call_leg_other(&leg->base);
+
+ if (!other) {
+ LOGP(DMNCC, LOGL_ERROR, "leg(%p) other leg gone!\n", leg);
+ sip_release_call(&leg->base);
+ return;
+ }
+
if (!sdp_get_sdp_mode(sip, &mode)) {
/* re-INVITE with no SDP.
* We should respond with SDP reflecting current session
@@ -540,6 +547,11 @@
OSMO_ASSERT(_leg->type == CALL_TYPE_SIP);
leg = (struct sip_call_leg *) _leg;
other_leg = call_leg_other(&leg->base);
+ if (!other_leg) {
+ LOGP(DMNCC, LOGL_ERROR, "leg(%p) other leg gone!\n", leg);
+ sip_release_call(&leg->base);
+ return;
+ }
char *sdp = sdp_create_file(leg, other_leg, sdp_sendonly);
nua_invite(leg->nua_handle,
NUTAG_MEDIA_ENABLE(0),
@@ -557,6 +569,11 @@
OSMO_ASSERT(_leg->type == CALL_TYPE_SIP);
leg = (struct sip_call_leg *) _leg;
other_leg = call_leg_other(&leg->base);
+ if (!other_leg) {
+ LOGP(DMNCC, LOGL_ERROR, "leg(%p) other leg gone!\n", leg);
+ sip_release_call(&leg->base);
+ return;
+ }
char *sdp = sdp_create_file(leg, other_leg, sdp_sendrecv);
nua_invite(leg->nua_handle,
NUTAG_MEDIA_ENABLE(0),
--
To view, visit https://gerrit.osmocom.org/c/osmo-sip-connector/+/15079
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: I947aab6c0cc5019929bde1c7012e1a8c3d3472a5
Gerrit-Change-Number: 15079
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/20190807/ae2b56cd/attachment.htm>