summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2016-11-26 10:14:53 +0100
committerHarald Welte <laforge@gnumonks.org>2016-11-26 13:47:14 +0000
commit1fa78567e4e1963a28711b9b47111b840b50cfdb (patch)
tree0f602348234aa6ea7d0a8fd47a9c3f36943f58b7
parent9533631e531671e7029bbe7bc2e264d9080f56c7 (diff)
osmo_gsup_encode(): Make coverity happy by invariant checking
gsm48_encode_bcd_number() can theoretically return a length in excess of the size of the bcd_buf, but only in case an overly-long IMSI is passed into the function (which would be illegal in the first place). Change-Id: If3dc68ee13ff784b487bbc686b777cec9057d537 Fixes: Coverity CID 135216
-rw-r--r--src/gsm/gsup.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/gsm/gsup.c b/src/gsm/gsup.c
index d6b49753..c90244aa 100644
--- a/src/gsm/gsup.c
+++ b/src/gsm/gsup.c
@@ -442,6 +442,7 @@ void osmo_gsup_encode(struct msgb *msg, const struct osmo_gsup_message *gsup_msg
gsup_msg->imsi);
OSMO_ASSERT(bcd_len > 1);
+ OSMO_ASSERT(bcd_len <= sizeof(bcd_buf));
/* Note that gsm48_encode_bcd_number puts the length into the first
* octet. Since msgb_tlv_put will add this length byte, we'll have to