Change in osmo-hlr[master]: hlr.c: check the presence of msgb->l2h in read_cb()

Vadim Yanitskiy gerrit-no-reply at lists.osmocom.org
Tue May 7 17:47:16 UTC 2019


Vadim Yanitskiy has submitted this change and it was merged. ( https://gerrit.osmocom.org/13899 )

Change subject: hlr.c: check the presence of msgb->l2h in read_cb()
......................................................................

hlr.c: check the presence of msgb->l2h in read_cb()

Checking the presence of msgb->l2h in read_cb_forward() doesn't
make sense, since in read_cb() we pass it to osmo_gsup_decode().
Let's rather do this before calling osmo_gsup_decode().

Fix for Change-Id: Ia4f345abc877baaf0a8f73b8988e6514d9589bf5
Change-Id: I69a3d31aacbbb1abef3d83e42e46c899fe2f914b
---
M src/hlr.c
1 file changed, 6 insertions(+), 6 deletions(-)

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



diff --git a/src/hlr.c b/src/hlr.c
index 3df700a..84daa47 100644
--- a/src/hlr.c
+++ b/src/hlr.c
@@ -483,11 +483,6 @@
 		goto end;
 	}
 
-	if (!msgb_l2(msg) || !msgb_l2len(msg)) {
-		LOGP_GSUP_FWD(gsup, LOGL_ERROR, "missing or empty l2 data\n");
-		goto end;
-	}
-
 	/* Forward message without re-encoding (so we don't remove unknown IEs) */
 	LOGP_GSUP_FWD(gsup, LOGL_INFO, "checks passed, forwarding\n");
 
@@ -524,10 +519,15 @@
 	static struct osmo_gsup_message gsup;
 	int rc;
 
+	if (!msgb_l2(msg) || !msgb_l2len(msg)) {
+		LOGP(DMAIN, LOGL_ERROR, "missing or empty L2 data\n");
+		return -EINVAL; /* FIXME: msgb_free(msg); */
+	}
+
 	rc = osmo_gsup_decode(msgb_l2(msg), msgb_l2len(msg), &gsup);
 	if (rc < 0) {
 		LOGP(DMAIN, LOGL_ERROR, "error in GSUP decode: %d\n", rc);
-		return rc;
+		return rc; /* FIXME: msgb_free(msg); */
 	}
 
 	/* 3GPP TS 23.003 Section 2.2 clearly states that an IMSI with less than 5

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

Gerrit-Project: osmo-hlr
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I69a3d31aacbbb1abef3d83e42e46c899fe2f914b
Gerrit-Change-Number: 13899
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy <axilirator at gmail.com>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Vadim Yanitskiy <axilirator at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190507/065a1b69/attachment.html>


More information about the gerrit-log mailing list