Change in libosmocore[master]: gprs_ns2: on ns2_create_vc parse the tlv before using it

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

lynxis lazus gerrit-no-reply at lists.osmocom.org
Tue Dec 15 11:56:29 UTC 2020


lynxis lazus has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/21723 )

Change subject: gprs_ns2: on ns2_create_vc parse the tlv before using it
......................................................................

gprs_ns2: on ns2_create_vc parse the tlv before using it

reject_status_msg require a parsed tlv. Otherwise an
uninitialized tlv is passed.

Change-Id: I82cab518966b8b49c3522ff5f7b6f82d1027a526
---
M src/gb/gprs_ns2.c
1 file changed, 9 insertions(+), 9 deletions(-)

Approvals:
  laforge: Looks good to me, but someone else must approve
  pespin: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/gb/gprs_ns2.c b/src/gb/gprs_ns2.c
index fd016e6..9d5a97c 100644
--- a/src/gb/gprs_ns2.c
+++ b/src/gb/gprs_ns2.c
@@ -798,6 +798,15 @@
 	if (msg->len < sizeof(struct gprs_ns_hdr))
 		return GPRS_NS2_CS_ERROR;
 
+	rc = ns2_tlv_parse(&tp, nsh->data,
+			   msgb_l2len(msg) - sizeof(*nsh), 0, 0);
+	if (rc < 0) {
+		LOGP(DLNS, LOGL_ERROR, "Rx NS RESET Error %d during "
+		     "TLV Parse\n", rc);
+		/* TODO: send invalid message back */
+		return GPRS_NS2_CS_REJECTED;
+	}
+
 	switch (nsh->pdu_type) {
 	case NS_PDUT_STATUS:
 		/* Do not respond, see 3GPP TS 08.16, 7.5.1 */
@@ -840,15 +849,6 @@
 		return GPRS_NS2_CS_REJECTED;
 	}
 
-	rc = ns2_tlv_parse(&tp, nsh->data,
-			   msgb_l2len(msg) - sizeof(*nsh), 0, 0);
-	if (rc < 0) {
-		LOGP(DLNS, LOGL_ERROR, "Rx NS RESET Error %d during "
-		     "TLV Parse\n", rc);
-		/* TODO: send invalid message back */
-		return GPRS_NS2_CS_REJECTED;
-	}
-
 	if (!TLVP_PRES_LEN(&tp, NS_IE_CAUSE, 1) ||
 	    !TLVP_PRES_LEN(&tp, NS_IE_VCI, 2) || !TLVP_PRES_LEN(&tp, NS_IE_NSEI, 2)) {
 		LOGP(DLNS, LOGL_ERROR, "NS RESET Missing mandatory IE\n");

-- 
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/21723
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I82cab518966b8b49c3522ff5f7b6f82d1027a526
Gerrit-Change-Number: 21723
Gerrit-PatchSet: 2
Gerrit-Owner: lynxis lazus <lynxis at fe80.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: lynxis lazus <lynxis at fe80.eu>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201215/2cb1ec10/attachment.htm>


More information about the gerrit-log mailing list