[MERGED] libosmocore[master]: osmo_gsup_encode(): Make coverity happy by invariant checking

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Sat Nov 26 16:07:35 UTC 2016


Harald Welte has submitted this change and it was merged.

Change subject: osmo_gsup_encode(): Make coverity happy by invariant checking
......................................................................


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
---
M src/gsm/gsup.c
1 file changed, 1 insertion(+), 0 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/gsm/gsup.c b/src/gsm/gsup.c
index d6b4975..c90244a 100644
--- a/src/gsm/gsup.c
+++ b/src/gsm/gsup.c
@@ -442,6 +442,7 @@
 					  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

-- 
To view, visit https://gerrit.osmocom.org/1301
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: If3dc68ee13ff784b487bbc686b777cec9057d537
Gerrit-PatchSet: 3
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list