[PATCH] libosmocore[master]: gsm0480: parse all SS info elements in a message

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
Wed Jan 17 09:10:53 UTC 2018


Hello Jenkins Builder,

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

    https://gerrit.osmocom.org/5839

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

gsm0480: parse all SS info elements in a message

Some SS messages (e.g. RELEASE COMPLETE) may contai multiple
IEs (Information Elements). Let's parse them all.

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


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/39/5839/2

diff --git a/src/gsm/gsm0480.c b/src/gsm/gsm0480.c
index e3856a5..0f30250 100644
--- a/src/gsm/gsm0480.c
+++ b/src/gsm/gsm0480.c
@@ -334,11 +334,15 @@
 	uint8_t iei;
 	uint8_t iei_length;
 
+	/* We need at least two bytes */
+	if (len < 2)
+		return 0;
+
 	iei = ss_ie[0];
 	iei_length = ss_ie[1];
 
 	/* If the data does not fit, report an error */
-	if (len - 2 < iei_length)
+	if (iei_length + 2 > len)
 		return 0;
 
 	switch (iei) {
@@ -356,6 +360,11 @@
 		break;
 	}
 
+	/* A message may contain multiple IEs */
+	if (iei_length + 2 + 2 < len)
+		rc &= parse_ss_info_elements(ss_ie + iei_length + 2,
+			len - iei_length - 2, req);
+
 	return rc;
 }
 

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I20cc59c25fdbda176bcf76437174cda829518d60
Gerrit-PatchSet: 2
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilirator at gmail.com>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list