summaryrefslogtreecommitdiffstats
path: root/src/gb/gprs_bssgp.c
diff options
context:
space:
mode:
authorStefan Sperling <ssperling@sysmocom.de>2018-06-25 12:20:43 +0200
committerStefan Sperling <ssperling@sysmocom.de>2018-06-25 12:20:43 +0200
commit2b544b257f3f855e50e27d4e599223862e282b53 (patch)
tree5ebf9f0de386a2227cb82d42bafd3d4d29c3838b /src/gb/gprs_bssgp.c
parent60f3153125fc07d406df90cde58ea658c929f5f8 (diff)
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
Diffstat (limited to 'src/gb/gprs_bssgp.c')
-rw-r--r--src/gb/gprs_bssgp.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/gb/gprs_bssgp.c b/src/gb/gprs_bssgp.c
index d5d4ea8a..1445a56b 100644
--- a/src/gb/gprs_bssgp.c
+++ b/src/gb/gprs_bssgp.c
@@ -1049,6 +1049,11 @@ int bssgp_rcvmsg(struct msgb *msg)
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);