aboutsummaryrefslogtreecommitdiffstats
path: root/src/gb/gprs_bssgp.c
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2015-04-07 17:52:44 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2015-04-07 20:10:09 +0200
commitb535e391b0f1d030373159ddbf54483d7fa54763 (patch)
tree8db65c8944d331c8bc35723c22d32dbf171292f9 /src/gb/gprs_bssgp.c
parentc641591ae9298894178dae78c37e5f96687be576 (diff)
bssgp: Ensure non-NULL bctx before calling bssgp_rx_ptp (Coverity)
Currently bssgp_rx_ptp might be called with bctx being NULL, when the NS BVCI is neither BVCI_SIGNALLING nor BVCI_PTM, but the message is a BVC_RESET or it contains an BVCI IE != BVCI_SIGNALLING where the BVCI is not known. This patch ensures that bssgp_rx_ptp will only be called with a non-NULL bctx. A log message will be issued, if the bctx is NULL when this was not expected. Fixes: Coverity CID 1040674 Sponsored-by: On-Waves ehf
Diffstat (limited to 'src/gb/gprs_bssgp.c')
-rw-r--r--src/gb/gprs_bssgp.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/gb/gprs_bssgp.c b/src/gb/gprs_bssgp.c
index a3fd6aa..4c93b69 100644
--- a/src/gb/gprs_bssgp.c
+++ b/src/gb/gprs_bssgp.c
@@ -1073,8 +1073,13 @@ int bssgp_rcvmsg(struct msgb *msg)
rc = bssgp_rx_sign(msg, &tp, bctx);
else if (ns_bvci == BVCI_PTM)
rc = bssgp_tx_status(BSSGP_CAUSE_PDU_INCOMP_FEAT, NULL, msg);
- else
+ else if (bctx)
rc = bssgp_rx_ptp(msg, &tp, bctx);
+ else
+ LOGP(DBSSGP, LOGL_NOTICE,
+ "NSEI=%u/BVCI=%u Cannot handle PDU type %u for "
+ "unknown BVCI, NS BVCI %u\n",
+ msgb_nsei(msg), bvci, pdu_type, ns_bvci);
return rc;
}