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

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/.

Vadim Yanitskiy gerrit-no-reply at lists.osmocom.org
Tue May 7 14:12:18 UTC 2019


Vadim Yanitskiy has uploaded this change for review. ( 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(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/99/13899/1

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: newchange
Gerrit-Change-Id: I69a3d31aacbbb1abef3d83e42e46c899fe2f914b
Gerrit-Change-Number: 13899
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy <axilirator at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190507/11a19450/attachment.htm>


More information about the gerrit-log mailing list