Change in libosmocore[master]: osmo_gsup_decode(): properly check IMSI, avoid deprecation

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
Sun May 5 16:23:43 UTC 2019


Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/13817 )

Change subject: osmo_gsup_decode(): properly check IMSI, avoid deprecation
......................................................................

osmo_gsup_decode(): properly check IMSI, avoid deprecation

In osmo_gsup_decode(), call gsm48_decode_bcd_number2() to avoid deprecation
warning, and also actually check the return value to detect invalid IMSI IEs.

Change-Id: Iaded84d91baad5386c8f353c283b6b9e40a43b05
---
M src/gsm/gsup.c
1 file changed, 5 insertions(+), 3 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Vadim Yanitskiy: Looks good to me, but someone else must approve
  Jenkins Builder: Verified



diff --git a/src/gsm/gsup.c b/src/gsm/gsup.c
index a3d9eef..2e6690e 100644
--- a/src/gsm/gsup.c
+++ b/src/gsm/gsup.c
@@ -332,9 +332,11 @@
 	 * before the value part already contains this length so we can use it
 	 * here.
 	 */
-	OSMO_ASSERT(value[-1] == value_len);
-	gsm48_decode_bcd_number(gsup_msg->imsi, sizeof(gsup_msg->imsi),
-				value - 1, 0);
+	if (gsm48_decode_bcd_number2(gsup_msg->imsi, sizeof(gsup_msg->imsi),
+				     value - 1, value_len + 1, 0)) {
+		LOGP(DLGSUP, LOGL_ERROR, "Cannot decode IMSI\n");
+		return -GMM_CAUSE_INV_MAND_INFO;
+	}
 
 	/* specific parts */
 	while (data_len > 0) {

-- 
To view, visit https://gerrit.osmocom.org/13817
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Iaded84d91baad5386c8f353c283b6b9e40a43b05
Gerrit-Change-Number: 13817
Gerrit-PatchSet: 3
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Vadim Yanitskiy <axilirator at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190505/fd9dff6c/attachment.htm>


More information about the gerrit-log mailing list