Change in osmo-msc[master]: gsm_04_11: use gsm48_decode_bcd_number2(), evaluate rc

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Mon May 6 01:19:52 UTC 2019


Neels Hofmeyr has uploaded this change for review. ( https://gerrit.osmocom.org/13881


Change subject: gsm_04_11: use gsm48_decode_bcd_number2(), evaluate rc
......................................................................

gsm_04_11: use gsm48_decode_bcd_number2(), evaluate rc

Avoid deprecation warning: use gsm48_decode_bcd_number2() instead of
gsm48_decode_bcd_number().

Validate the return value and add error handling.

Change-Id: Ibef71c46d72d2d43123e68f73e5ed554a69243d8
---
M src/libmsc/gsm_04_11.c
1 file changed, 6 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/81/13881/1

diff --git a/src/libmsc/gsm_04_11.c b/src/libmsc/gsm_04_11.c
index 8cbed3e..577a13a 100644
--- a/src/libmsc/gsm_04_11.c
+++ b/src/libmsc/gsm_04_11.c
@@ -508,8 +508,12 @@
 	gsms->dst.ton = (address_lv[1] >> 4) & 7;
 	gsms->dst.npi = address_lv[1] & 0xF;
 	/* convert to real number */
-	gsm48_decode_bcd_number(gsms->dst.addr,
-				sizeof(gsms->dst.addr), address_lv, 1);
+	if (gsm48_decode_bcd_number2(gsms->dst.addr,
+				     sizeof(gsms->dst.addr), address_lv, da_len_bytes, 1)) {
+		LOG_TRANS(trans, LOGL_ERROR, "Failed to decode destination Address\n");
+		rc = GSM411_RP_CAUSE_SEMANT_INC_MSG;
+		goto out;
+	}
 	smsp += da_len_bytes;
 
 	gsms->protocol_id = *smsp++;

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

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibef71c46d72d2d43123e68f73e5ed554a69243d8
Gerrit-Change-Number: 13881
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/20190506/9eed222b/attachment.html>


More information about the gerrit-log mailing list