Change in osmo-pcu[master]: check bssgp_tlv_parse() return code in gprs_bssgp_pcu_rcvmsg()

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

Stefan Sperling gerrit-no-reply at lists.osmocom.org
Mon Jun 25 10:21:44 UTC 2018


Stefan Sperling has uploaded this change for review. ( https://gerrit.osmocom.org/9728


Change subject: check bssgp_tlv_parse() return code in gprs_bssgp_pcu_rcvmsg()
......................................................................

check bssgp_tlv_parse() return code in gprs_bssgp_pcu_rcvmsg()

The return code from bssgp_tlv_parse() was not checked for a parsing
error. In case of a parsing error the stored return code could have
been overwritten later in this function.

Explicitly check for a parsing error and log corresponding packets.

Change-Id: I56e10a97cda7fd2d40bc7b4b2e6202f97772e1b3
Related: OS#3178
---
M src/gprs_bssgp_pcu.cpp
1 file changed, 5 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/28/9728/1

diff --git a/src/gprs_bssgp_pcu.cpp b/src/gprs_bssgp_pcu.cpp
index 1524fb3..1f58809 100644
--- a/src/gprs_bssgp_pcu.cpp
+++ b/src/gprs_bssgp_pcu.cpp
@@ -388,6 +388,11 @@
 		data_len = msgb_bssgp_len(msg) - sizeof(*budh);
 		rc = bssgp_tlv_parse(&tp, budh->data, data_len);
 	}
+	if (rc < 0) {
+		LOGP(DBSSGP, LOGL_ERROR, "Failed to parse BSSGP %s message. Invalid message was: %s\n",
+		     bssgp_pdu_str(pdu_type), msgb_hexdump(msg));
+		return rc;
+	}
 
 	if (pdu_type == BSSGP_PDUT_BVC_RESET) {
 		rc = bssgp_rcvmsg(msg);

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

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I56e10a97cda7fd2d40bc7b4b2e6202f97772e1b3
Gerrit-Change-Number: 9728
Gerrit-PatchSet: 1
Gerrit-Owner: Stefan Sperling <ssperling at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180625/96632669/attachment.htm>


More information about the gerrit-log mailing list