[MERGED] libosmo-sccp[master]: osmo_sccp_addr_encode(): Catch some more errors and log them

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

Harald Welte gerrit-no-reply at lists.osmocom.org
Fri Oct 27 16:12:55 UTC 2017


Harald Welte has submitted this change and it was merged.

Change subject: osmo_sccp_addr_encode(): Catch some more errors and log them
......................................................................


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(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



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: merged
Gerrit-Change-Id: I493b7810bdc58e448f496565ded36f9dce2c1226
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list