[MERGED] libosmocore[master]: gsm0480: handle UnstructuredSS Request with DSC != 0x0F
Harald Welte has submitted this change and it was merged. Change subject: gsm0480: handle UnstructuredSS Request with DSC != 0x0F .. 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, 20 insertions(+), 0 deletions(-) Approvals: Alexander Chemeris: Looks good to me, but someone else must approve Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/gsm/gsm0480.c b/src/gsm/gsm0480.c index 11c66e9..b0b28e4 100644 --- a/src/gsm/gsm0480.c +++ b/src/gsm/gsm0480.c @@ -453,9 +453,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 > GSM0480_USSD_7BIT_STRING_LEN) num_chars = GSM0480_USSD_7BIT_STRING_LEN; @@ -464,6 +473,17 @@ sizeof(req->ussd_text), &(uss_req_data[7]), 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 > GSM0480_USSD_OCTET_STRING_LEN) + num_chars = GSM0480_USSD_OCTET_STRING_LEN; + + memcpy(req->ussd_text, &(uss_req_data[7]), num_chars); + + return 1; } return 0; -- To view, visit https://gerrit.osmocom.org/3376 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I73d602f6f20b0afe7600d16bbd432069ae7be788 Gerrit-PatchSet: 10 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim YanitskiyGerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Ivan Kluchnikov Gerrit-Reviewer: Jenkins Builder
libosmocore[master]: gsm0480: handle UnstructuredSS Request with DSC != 0x0F
Patch Set 9: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/3376 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I73d602f6f20b0afe7600d16bbd432069ae7be788 Gerrit-PatchSet: 9 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim YanitskiyGerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Ivan Kluchnikov Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No
libosmocore[master]: gsm0480: handle UnstructuredSS Request with DSC != 0x0F
Patch Set 9: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/3376 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I73d602f6f20b0afe7600d16bbd432069ae7be788 Gerrit-PatchSet: 9 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim YanitskiyGerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Ivan Kluchnikov Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No
[PATCH] libosmocore[master]: gsm0480: handle UnstructuredSS Request with DSC != 0x0F
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 (#9). 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, 20 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/76/3376/9 diff --git a/src/gsm/gsm0480.c b/src/gsm/gsm0480.c index 11c66e9..b0b28e4 100644 --- a/src/gsm/gsm0480.c +++ b/src/gsm/gsm0480.c @@ -453,9 +453,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 > GSM0480_USSD_7BIT_STRING_LEN) num_chars = GSM0480_USSD_7BIT_STRING_LEN; @@ -464,6 +473,17 @@ sizeof(req->ussd_text), &(uss_req_data[7]), 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 > GSM0480_USSD_OCTET_STRING_LEN) + num_chars = GSM0480_USSD_OCTET_STRING_LEN; + + memcpy(req->ussd_text, &(uss_req_data[7]), 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: 9 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim YanitskiyGerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Ivan Kluchnikov Gerrit-Reviewer: Jenkins Builder
libosmocore[master]: gsm0480: handle UnstructuredSS Request with DSC != 0x0F
Patch Set 8: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/3376 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I73d602f6f20b0afe7600d16bbd432069ae7be788 Gerrit-PatchSet: 8 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim YanitskiyGerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Ivan Kluchnikov Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No
[PATCH] libosmocore[master]: gsm0480: handle UnstructuredSS Request with DSC != 0x0F
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 (#8). 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, 20 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/76/3376/8 diff --git a/src/gsm/gsm0480.c b/src/gsm/gsm0480.c index 2bd6565..9e71a86 100644 --- a/src/gsm/gsm0480.c +++ b/src/gsm/gsm0480.c @@ -453,9 +453,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 > GSM0408_USSD_7BIT_STRING_LEN) num_chars = GSM0408_USSD_7BIT_STRING_LEN; @@ -464,6 +473,17 @@ sizeof(req->ussd_text), &(uss_req_data[7]), 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 > GSM0408_USSD_OCTET_STRING_LEN) + num_chars = GSM0408_USSD_OCTET_STRING_LEN; + + memcpy(req->ussd_text, &(uss_req_data[7]), 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: 8 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim YanitskiyGerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Ivan Kluchnikov Gerrit-Reviewer: Jenkins Builder
libosmocore[master]: gsm0480: handle UnstructuredSS Request with DSC != 0x0F
Patch Set 7: Code-Review+2 (1 comment) https://gerrit.osmocom.org/#/c/3376/7/src/gsm/gsm0480.c File src/gsm/gsm0480.c: Line 478: num_chars = uss_req_data[6]; > do we actually verify that we have at least 6 bytes of data available in us Sorry, I must be blind. We verify 8 bytes above. -- To view, visit https://gerrit.osmocom.org/3376 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I73d602f6f20b0afe7600d16bbd432069ae7be788 Gerrit-PatchSet: 7 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim YanitskiyGerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Ivan Kluchnikov Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: Yes
libosmocore[master]: gsm0480: handle UnstructuredSS Request with DSC != 0x0F
Patch Set 7: (1 comment) https://gerrit.osmocom.org/#/c/3376/7/src/gsm/gsm0480.c File src/gsm/gsm0480.c: Line 478: num_chars = uss_req_data[6]; do we actually verify that we have at least 6 bytes of data available in uss_rea_data[] buffer? What if the sender sent a short/truncated message? -- To view, visit https://gerrit.osmocom.org/3376 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I73d602f6f20b0afe7600d16bbd432069ae7be788 Gerrit-PatchSet: 7 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim YanitskiyGerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Ivan Kluchnikov Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: Yes
[PATCH] libosmocore[master]: gsm0480: handle UnstructuredSS Request with DSC != 0x0F
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 YanitskiyGerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Ivan Kluchnikov Gerrit-Reviewer: Jenkins Builder
[PATCH] libosmocore[master]: gsm0480: handle UnstructuredSS request with DSC != 0x0F
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 (#6). gsm0480: handle UnstructuredSS request with DSC != 0x0F Change-Id: I73d602f6f20b0afe7600d16bbd432069ae7be788 --- M src/gsm/gsm0480.c 1 file changed, 11 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/76/3376/6 diff --git a/src/gsm/gsm0480.c b/src/gsm/gsm0480.c index 12ae1a3..ecbea8c 100644 --- a/src/gsm/gsm0480.c +++ b/src/gsm/gsm0480.c @@ -464,6 +464,17 @@ req->ussd_text_len = num_chars; return 1; + } else { + num_chars = uss_req_data[6]; + /* Prevent a mobile-originated buffer-overrun! */ + if (num_chars > MAX_LEN_USSD_STRING) + num_chars = MAX_LEN_USSD_STRING; + + req->ussd_text_language = dcs; + req->ussd_text_len = num_chars; + memcpy(req->ussd_text, &(uss_req_data[7]), 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: 6 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim YanitskiyGerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Ivan Kluchnikov Gerrit-Reviewer: Jenkins Builder
[PATCH] libosmocore[master]: gsm0480: handle UnstructuredSS request with DSC != 0x0F
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 (#5). gsm0480: handle UnstructuredSS request with DSC != 0x0F Change-Id: I73d602f6f20b0afe7600d16bbd432069ae7be788 --- M src/gsm/gsm0480.c 1 file changed, 11 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/76/3376/5 diff --git a/src/gsm/gsm0480.c b/src/gsm/gsm0480.c index 12ae1a3..ecbea8c 100644 --- a/src/gsm/gsm0480.c +++ b/src/gsm/gsm0480.c @@ -464,6 +464,17 @@ req->ussd_text_len = num_chars; return 1; + } else { + num_chars = uss_req_data[6]; + /* Prevent a mobile-originated buffer-overrun! */ + if (num_chars > MAX_LEN_USSD_STRING) + num_chars = MAX_LEN_USSD_STRING; + + req->ussd_text_language = dcs; + req->ussd_text_len = num_chars; + memcpy(req->ussd_text, &(uss_req_data[7]), 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: 5 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim YanitskiyGerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Ivan Kluchnikov Gerrit-Reviewer: Jenkins Builder
libosmocore[master]: gsm0480: handle UnstructuredSS request with DSC != 0x0F
Patch Set 3: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/3376 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I73d602f6f20b0afe7600d16bbd432069ae7be788 Gerrit-PatchSet: 3 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim YanitskiyGerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Ivan Kluchnikov Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No
libosmocore[master]: gsm0480: handle UnstructuredSS request with DSC != 0x0F
Patch Set 3: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/3376 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I73d602f6f20b0afe7600d16bbd432069ae7be788 Gerrit-PatchSet: 3 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim YanitskiyGerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Ivan Kluchnikov Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No
[PATCH] libosmocore[master]: gsm0480: handle UnstructuredSS request with DSC != 0x0F
gsm0480: handle UnstructuredSS request with DSC != 0x0F Change-Id: I73d602f6f20b0afe7600d16bbd432069ae7be788 --- M src/gsm/gsm0480.c 1 file changed, 11 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/76/3376/2 diff --git a/src/gsm/gsm0480.c b/src/gsm/gsm0480.c index de99223..87095d2 100644 --- a/src/gsm/gsm0480.c +++ b/src/gsm/gsm0480.c @@ -455,6 +455,17 @@ req->ussd_text_len = num_chars; return 1; + } else { + num_chars = uss_req_data[6]; + /* Prevent a mobile-originated buffer-overrun! */ + if (num_chars > MAX_LEN_USSD_STRING) + num_chars = MAX_LEN_USSD_STRING; + + req->ussd_text_language = dcs; + req->ussd_text_len = num_chars; + memcpy(req->ussd_text, &(uss_req_data[7]), 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: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim YanitskiyGerrit-Reviewer: Jenkins Builder
[PATCH] libosmocore[master]: gsm0480: handle UnstructuredSS request with DSC != 0x0F
Review at https://gerrit.osmocom.org/3376 gsm0480: handle UnstructuredSS request with DSC != 0x0F Change-Id: I73d602f6f20b0afe7600d16bbd432069ae7be788 --- M src/gsm/gsm0480.c 1 file changed, 11 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/76/3376/1 diff --git a/src/gsm/gsm0480.c b/src/gsm/gsm0480.c index de99223..87095d2 100644 --- a/src/gsm/gsm0480.c +++ b/src/gsm/gsm0480.c @@ -455,6 +455,17 @@ req->ussd_text_len = num_chars; return 1; + } else { + num_chars = uss_req_data[6]; + /* Prevent a mobile-originated buffer-overrun! */ + if (num_chars > MAX_LEN_USSD_STRING) + num_chars = MAX_LEN_USSD_STRING; + + req->ussd_text_language = dcs; + req->ussd_text_len = num_chars; + memcpy(req->ussd_text, &(uss_req_data[7]), num_chars); + + return 1; } return 0; -- To view, visit https://gerrit.osmocom.org/3376 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I73d602f6f20b0afe7600d16bbd432069ae7be788 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy