Change in osmo-msc[master]: libmsc/msc_a.c: fix possible NULL-pointer dereferences

Harald Welte gerrit-no-reply at lists.osmocom.org
Mon May 13 20:15:05 UTC 2019


Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/13976 )

Change subject: libmsc/msc_a.c: fix possible NULL-pointer dereferences
......................................................................

libmsc/msc_a.c: fix possible NULL-pointer dereferences

Change-Id: Id5c95fbf318a2e51e7ffee2e08ceab3042b26cc9
Fixes: CID#198411, CID#198414
---
M src/libmsc/msc_a.c
1 file changed, 25 insertions(+), 7 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/libmsc/msc_a.c b/src/libmsc/msc_a.c
index 5137e20..cfba545 100644
--- a/src/libmsc/msc_a.c
+++ b/src/libmsc/msc_a.c
@@ -245,10 +245,18 @@
 int msc_a_vlr_set_cipher_mode(void *_msc_a, bool umts_aka, bool retrieve_imeisv)
 {
 	struct msc_a *msc_a = _msc_a;
-	struct vlr_subscr *vsub = msc_a_vsub(msc_a);
+	struct vlr_subscr *vsub;
 
-	if (!msc_a || !vsub || !vsub->last_tuple) {
-		LOG_MSC_A(msc_a, LOGL_ERROR, "Insufficient info to start ciphering\n");
+	if (!msc_a) {
+		LOGP(DMSC, LOGL_ERROR, "Insufficient info to start ciphering: "
+				       "MSC-A role is NULL?!?\n");
+		return -EINVAL;
+	}
+
+	vsub = msc_a_vsub(msc_a);
+	if (!vsub || !vsub->last_tuple) {
+		LOG_MSC_A(msc_a, LOGL_ERROR, "Insufficient info to start ciphering: "
+					     "vlr_subscr is NULL?!?\n");
 		return -EINVAL;
 	}
 
@@ -280,12 +288,22 @@
 
 static int msc_a_ran_enc_ciphering(struct msc_a *msc_a, bool umts_aka, bool retrieve_imeisv)
 {
-	struct gsm_network *net = msc_a_net(msc_a);
-	struct vlr_subscr *vsub = msc_a_vsub(msc_a);
+	struct gsm_network *net;
+	struct vlr_subscr *vsub;
 	struct ran_msg msg;
 
-	if (!msc_a || !vsub || !vsub->last_tuple) {
-		LOG_MSC_A(msc_a, LOGL_ERROR, "Insufficient info to start ciphering\n");
+	if (!msc_a) {
+		LOGP(DMSC, LOGL_ERROR, "Insufficient info to start ciphering: "
+				       "MSC-A role is NULL?!?\n");
+		return -EINVAL;
+	}
+
+	net = msc_a_net(msc_a);
+	vsub = msc_a_vsub(msc_a);
+
+	if (!net || !vsub || !vsub->last_tuple) {
+		LOG_MSC_A(msc_a, LOGL_ERROR, "Insufficient info to start ciphering: "
+					     "gsm_network and/or vlr_subscr is NULL?!?\n");
 		return -EINVAL;
 	}
 

-- 
To view, visit https://gerrit.osmocom.org/13976
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Id5c95fbf318a2e51e7ffee2e08ceab3042b26cc9
Gerrit-Change-Number: 13976
Gerrit-PatchSet: 3
Gerrit-Owner: Vadim Yanitskiy <axilirator at gmail.com>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190513/43787c5a/attachment.html>


More information about the gerrit-log mailing list