aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/gprs
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2010-07-23 21:59:29 +0200
committerHarald Welte <laforge@gnumonks.org>2010-07-23 22:00:45 +0200
commitd30e0875217a20cae9d3451e84d80b45eab52e73 (patch)
treecfea9c1a0f892e8c392f609f6f55bdcf1af62217 /openbsc/src/gprs
parent6e95c5ffa17761bc9ab7e308edd8a83b286eea3f (diff)
[gprs] BSSGP: Fix null pointer dereference
Zecke has found this using "make CC="clang --analyze"
Diffstat (limited to 'openbsc/src/gprs')
-rw-r--r--openbsc/src/gprs/gprs_bssgp.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/openbsc/src/gprs/gprs_bssgp.c b/openbsc/src/gprs/gprs_bssgp.c
index 30bc0f9b4..051ec92f8 100644
--- a/openbsc/src/gprs/gprs_bssgp.c
+++ b/openbsc/src/gprs/gprs_bssgp.c
@@ -429,7 +429,7 @@ static int bssgp_rx_resume(struct msgb *msg, struct tlv_parsed *tp,
static int bssgp_rx_llc_disc(struct msgb *msg, struct tlv_parsed *tp,
struct bssgp_bvc_ctx *ctx)
{
- uint32_t tlli;
+ uint32_t tlli = 0;
if (!TLVP_PRESENT(tp, BSSGP_IE_TLLI) ||
!TLVP_PRESENT(tp, BSSGP_IE_LLC_FRAMES_DISCARDED) ||
@@ -439,7 +439,8 @@ static int bssgp_rx_llc_disc(struct msgb *msg, struct tlv_parsed *tp,
"missing mandatory IE\n", ctx->bvci);
}
- tlli = ntohl(*(uint32_t *)TLVP_VAL(tp, BSSGP_IE_TLLI));
+ if (TLVP_PRESENT(tp, BSSGP_IE_TLLI))
+ tlli = ntohl(*(uint32_t *)TLVP_VAL(tp, BSSGP_IE_TLLI));
DEBUGP(DBSSGP, "BSSGP BVCI=%u TLLI=%08x LLC DISCARDED\n",
ctx->bvci, tlli);