Review at  https://gerrit.osmocom.org/4450

osmo_sccp_addr_encode(): Catch some more errors and log them

Log errors in case the user provides global title indicators or
nature-of-address indicators that exceed the permitted value range

Change-Id: I493b7810bdc58e448f496565ded36f9dce2c1226
---
M src/sccp2sua.c
1 file changed, 10 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/50/4450/1

diff --git a/src/sccp2sua.c b/src/sccp2sua.c
index ac2b2c2..d97906e 100644
--- a/src/sccp2sua.c
+++ b/src/sccp2sua.c
@@ -262,6 +262,16 @@
                goto out;
        }
 
+       if (in->gt.npi && (in->gt.npi > 0xF)) {
+               LOGP(DLSUA, LOGL_ERROR, "Unsupported Numbering Plan %u", 
in->gt.npi);
+               return -EINVAL;
+       }
+
+       if (in->gt.nai && (in->gt.nai > 0x7F)) {
+               LOGP(DLSUA, LOGL_ERROR, "Unsupported Nature of Address %u", 
in->gt.nai);
+               return -EINVAL;
+       }
+
        odd = strlen(in->gt.digits) & 1;
        switch (in->gt.gti) {
        case OSMO_SCCP_GTI_NO_GT:

-- 
To view, visit https://gerrit.osmocom.org/4450
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I493b7810bdc58e448f496565ded36f9dce2c1226
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <[email protected]>

Reply via email to