Change in libosmocore[master]: check bssgp_tlv_parse() return code in bssgp_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:53 UTC 2018


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


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

check bssgp_tlv_parse() return code in bssgp_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: Id3d7c52ec3df2bcf4efcee0e0b14fe22ef96964e
Related: OS#3178
---
M src/gb/gprs_bssgp.c
1 file changed, 5 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/29/9729/1

diff --git a/src/gb/gprs_bssgp.c b/src/gb/gprs_bssgp.c
index d5d4ea8..1445a56 100644
--- a/src/gb/gprs_bssgp.c
+++ b/src/gb/gprs_bssgp.c
@@ -1049,6 +1049,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 (bvci == BVCI_SIGNALLING && TLVP_PRESENT(&tp, BSSGP_IE_BVCI))
 		bvci = tlvp_val16be(&tp, BSSGP_IE_BVCI);

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id3d7c52ec3df2bcf4efcee0e0b14fe22ef96964e
Gerrit-Change-Number: 9729
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/051c936d/attachment.htm>


More information about the gerrit-log mailing list