mirror of https://gerrit.osmocom.org/libosmocore
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
This commit is contained in:
parent
60f3153125
commit
2b544b257f
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue