[PATCH] libosmocore[master]: gsm0480: handle UnstructuredSS Request with DSC != 0x0F

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

Vadim Yanitskiy gerrit-no-reply at lists.osmocom.org
Thu Jan 11 17:49:07 UTC 2018


Hello Alexander Chemeris, Harald Welte, Jenkins Builder,

I'd like you to reexamine a change.  Please visit

    https://gerrit.osmocom.org/3376

to look at the new patch set (#7).

gsm0480: handle UnstructuredSS Request with DSC != 0x0F

According to GSM 04.08, 4.4.2 "ASN.1 data types":
the USSD-DataCodingScheme shall indicate use of
the default alphabet using the 0x0F value.

Previously, the UnstructuredSS Request messages with not
default alphabet were not being handled. Let's fix this.

Change-Id: I73d602f6f20b0afe7600d16bbd432069ae7be788
---
M src/gsm/gsm0480.c
1 file changed, 23 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/76/3376/7

diff --git a/src/gsm/gsm0480.c b/src/gsm/gsm0480.c
index b2e521a..bfa0287 100644
--- a/src/gsm/gsm0480.c
+++ b/src/gsm/gsm0480.c
@@ -450,9 +450,18 @@
 	if ((uss_req_data[2] & uss_req_data[5]) != ASN1_OCTET_STRING_TAG)
 		return 0;
 
+	/* Get DCS (Data Coding Scheme) */
 	dcs = uss_req_data[4];
+
+	/**
+	 * According to GSM 04.08, 4.4.2 "ASN.1 data types":
+	 * the USSD-DataCodingScheme shall indicate use of
+	 * the default alphabet using the 0x0F value.
+	 */
 	if (dcs == 0x0F) {
+		/* Calculate the amount of 7-bit characters */
 		num_chars = (uss_req_data[6] * 8) / 7;
+
 		/* Prevent a mobile-originated buffer-overrun! */
 		if (num_chars > MAX_LEN_USSD_7BIT_STRING)
 			num_chars = MAX_LEN_USSD_7BIT_STRING;
@@ -464,6 +473,20 @@
 		req->ussd_text_len = num_chars;
 
 		return 1;
+	} else {
+		/* Get the amount of 8-bit characters */
+		num_chars = uss_req_data[6];
+
+		/* Prevent a mobile-originated buffer-overrun! */
+		if (num_chars > MAX_LEN_USSD_OCTET_STRING)
+			num_chars = MAX_LEN_USSD_OCTET_STRING;
+
+		memcpy(req->ussd_text, &(uss_req_data[7]), num_chars);
+
+		req->ussd_text_language = dcs;
+		req->ussd_text_len = num_chars;
+
+		return 1;
 	}
 
 	return 0;

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I73d602f6f20b0afe7600d16bbd432069ae7be788
Gerrit-PatchSet: 7
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilirator at gmail.com>
Gerrit-Reviewer: Alexander Chemeris <Alexander.Chemeris at gmail.com>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Ivan Kluchnikov <kluchnikovi at gmail.com>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list