summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2017-10-27 17:59:21 +0200
committerHarald Welte <laforge@gnumonks.org>2017-10-27 18:00:12 +0200
commit212d0c4c7614c2ec2796dd21ab240c2d70743a1e (patch)
tree714b185008152b3e12899e67d636495038734e7e
parentc755c1d1b02d748cf27cc805d37553894816833a (diff)
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
-rw-r--r--src/sccp2sua.c10
1 files changed, 10 insertions, 0 deletions
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 @@ int osmo_sccp_addr_encode(struct msgb *msg, const struct osmo_sccp_addr *in)
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: