Hello Alexander Chemeris, Harald Welte, Jenkins Builder,

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

    https://gerrit.osmocom.org/3377

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

gsm0480: parse GSM0480_MTYPE_FACILITY separately

Change-Id: I6e029c436a50fa8c2823ea39c5d123ee701becfa
---
M src/gsm/gsm0480.c
1 file changed, 17 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/77/3377/6

diff --git a/src/gsm/gsm0480.c b/src/gsm/gsm0480.c
index ecbea8c..d717270 100644
--- a/src/gsm/gsm0480.c
+++ b/src/gsm/gsm0480.c
@@ -196,6 +196,8 @@
 /* Forward declarations */
 static int parse_ss(const struct gsm48_hdr *hdr,
                    uint16_t len, struct gsm0480_ss_request *req);
+static int parse_ss_facility(const uint8_t *ss_facility, uint16_t len,
+                            struct gsm0480_ss_request *req);
 static int parse_ss_info_elements(const uint8_t *ussd_ie, uint16_t len,
                                  struct gsm0480_ss_request *req);
 static int parse_facility_ie(const uint8_t *facility_ie, uint16_t length,
@@ -281,8 +283,10 @@
                req->ussd_text[0] = 0xFF;
                break;
        case GSM0480_MTYPE_REGISTER:
-       case GSM0480_MTYPE_FACILITY:
                rc &= parse_ss_info_elements(&hdr->data[0], len - sizeof(*hdr), 
req);
+               break;
+       case GSM0480_MTYPE_FACILITY:
+               rc &= parse_ss_facility(&hdr->data[0], len - sizeof(*hdr), req);
                break;
        default:
                LOGP(0, LOGL_DEBUG, "Unknown GSM 04.80 message-type field 
0x%02x\n",
@@ -294,6 +298,18 @@
        return rc;
 }
 
+static int parse_ss_facility(const uint8_t *ss_facility, uint16_t len,
+                            struct gsm0480_ss_request *req)
+{
+       uint8_t facility_length;
+
+       facility_length = ss_facility[0];
+       if (len - 1 < facility_length)
+               return 0;
+
+       return parse_facility_ie(ss_facility + 1, facility_length, req);
+}
+
 static int parse_ss_info_elements(const uint8_t *ss_ie, uint16_t len,
                                  struct gsm0480_ss_request *req)
 {

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I6e029c436a50fa8c2823ea39c5d123ee701becfa
Gerrit-PatchSet: 6
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com>
Gerrit-Reviewer: Alexander Chemeris <alexander.cheme...@gmail.com>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Ivan Kluchnikov <kluchnik...@gmail.com>
Gerrit-Reviewer: Jenkins Builder

Reply via email to