diff options
author | Neels Hofmeyr <nhofmeyr@sysmocom.de> | 2016-05-09 21:38:51 +0200 |
---|---|---|
committer | Neels Hofmeyr <nhofmeyr@sysmocom.de> | 2016-09-18 23:40:06 +0200 |
commit | ffaed9eed2a9342adc303bd429a136c8ea247abe (patch) | |
tree | 722e3b14ecdad5ca8c4739a696ebd343c795abeb /openbsc/src | |
parent | 378a492fd9e815ceb8151c05445de9315835975d (diff) |
Sanity fixes for gsm0408_dispatch(): rc, assertions
gsm0408_dispatch() is the main entry point for receiving data from the BSC/RNC
level, so make sure callers pass valid pointers before using them all the way
down the code path (related to CID#93769, a fix before this was refactored).
For unknown/unimplemented packet discriminators, make sure to return error
codes.
Change-Id: Ieec39c74a53ef4dfa971dd935c8c9aa60fef58c1
Diffstat (limited to 'openbsc/src')
-rw-r--r-- | openbsc/src/libmsc/gsm_04_08.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/openbsc/src/libmsc/gsm_04_08.c b/openbsc/src/libmsc/gsm_04_08.c index 76217ae5c..08dac63ed 100644 --- a/openbsc/src/libmsc/gsm_04_08.c +++ b/openbsc/src/libmsc/gsm_04_08.c @@ -3664,6 +3664,9 @@ int gsm0408_dispatch(struct gsm_subscriber_connection *conn, struct msgb *msg) uint8_t pdisc = gsm48_hdr_pdisc(gh); int rc = 0; + OSMO_ASSERT(conn); + OSMO_ASSERT(msg); + LOGP(DRLL, LOGL_DEBUG, "Dispatching 04.08 message, pdisc=%d\n", pdisc); if (silent_call_reroute(conn, msg)) return silent_call_rx(conn, msg); @@ -3687,6 +3690,7 @@ int gsm0408_dispatch(struct gsm_subscriber_connection *conn, struct msgb *msg) case GSM48_PDISC_SM_GPRS: LOGP(DRLL, LOGL_NOTICE, "Unimplemented " "GSM 04.08 discriminator 0x%02x\n", pdisc); + rc = -ENOTSUP; break; case GSM48_PDISC_NC_SS: release_anchor(conn); @@ -3695,6 +3699,7 @@ int gsm0408_dispatch(struct gsm_subscriber_connection *conn, struct msgb *msg) default: LOGP(DRLL, LOGL_NOTICE, "Unknown " "GSM 04.08 discriminator 0x%02x\n", pdisc); + rc = -EINVAL; break; } |