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

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Tue Apr 30 00:54:57 UTC 2019


Neels Hofmeyr has uploaded this change for review. ( 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(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/17/13817/1

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: newchange
Gerrit-Change-Id: Iaded84d91baad5386c8f353c283b6b9e40a43b05
Gerrit-Change-Number: 13817
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190430/5785c94d/attachment.html>


More information about the gerrit-log mailing list