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

Harald Welte gerrit-no-reply at lists.osmocom.org
Wed May 8 06:31:11 UTC 2019


Harald Welte has submitted this change and it was merged. ( 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(-)

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



diff --git a/src/libmsc/gsm_04_11.c b/src/libmsc/gsm_04_11.c
index 71069dc..85b861c 100644
--- a/src/libmsc/gsm_04_11.c
+++ b/src/libmsc/gsm_04_11.c
@@ -526,8 +526,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: merged
Gerrit-Change-Id: Ibef71c46d72d2d43123e68f73e5ed554a69243d8
Gerrit-Change-Number: 13881
Gerrit-PatchSet: 5
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/20190508/04b9ed0c/attachment.html>


More information about the gerrit-log mailing list