Change in osmo-sgsn[master]: Use explicit length check

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/.

Max gerrit-no-reply at lists.osmocom.org
Mon Dec 10 14:31:36 UTC 2018


Max has uploaded this change for review. ( https://gerrit.osmocom.org/12229


Change subject: Use explicit length check
......................................................................

Use explicit length check

Use OSMO_MIN macro to check for MSISDN length. This makes the code
cleaner and will, hopefully, aid static analysis tools.

Change-Id: Ic0fbeb8d248c74e54bfb51ba2cdea55c4f386ac7
Fixes: CID57879
---
M src/gprs/sgsn_libgtp.c
1 file changed, 1 insertion(+), 3 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/29/12229/1

diff --git a/src/gprs/sgsn_libgtp.c b/src/gprs/sgsn_libgtp.c
index 478d402..a8a1502 100644
--- a/src/gprs/sgsn_libgtp.c
+++ b/src/gprs/sgsn_libgtp.c
@@ -176,9 +176,7 @@
 
 	/* Put the MSISDN in case we have it */
 	if (mmctx->subscr && mmctx->subscr->sgsn_data->msisdn_len) {
-		pdp->msisdn.l = mmctx->subscr->sgsn_data->msisdn_len;
-		if (pdp->msisdn.l > sizeof(pdp->msisdn.v))
-			pdp->msisdn.l = sizeof(pdp->msisdn.v);
+		pdp->msisdn.l = OSMO_MIN(mmctx->subscr->sgsn_data->msisdn_len, sizeof(pdp->msisdn.v));
 		memcpy(pdp->msisdn.v, mmctx->subscr->sgsn_data->msisdn,
 			pdp->msisdn.l);
 	} else {

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

Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic0fbeb8d248c74e54bfb51ba2cdea55c4f386ac7
Gerrit-Change-Number: 12229
Gerrit-PatchSet: 1
Gerrit-Owner: Max <msuraev at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181210/e2932d87/attachment.htm>


More information about the gerrit-log mailing list