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 <[email protected]>

Reply via email to