[PATCH] 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 09:24:22 UTC 2016


Review at  https://gerrit.osmocom.org/1301

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(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/01/1301/1

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: newchange
Gerrit-Change-Id: If3dc68ee13ff784b487bbc686b777cec9057d537
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>



More information about the gerrit-log mailing list