aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2019-05-07 20:53:54 +0700
committerVadim Yanitskiy <axilirator@gmail.com>2019-05-07 21:12:04 +0700
commitc69a18bb3d7ac8deae5c7ebf4790c1ac8a375b65 (patch)
tree9eb9fbf69d80f14166e992150436f0e960b0d214
parent8625cdaf2aaf95057e21cb754929d9fe21f2e424 (diff)
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
-rw-r--r--src/hlr.c12
1 files changed, 6 insertions, 6 deletions
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 @@ static int read_cb_forward(struct osmo_gsup_conn *conn, struct msgb *msg, const
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 int read_cb(struct osmo_gsup_conn *conn, struct msgb *msg)
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