diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2018-06-28 16:34:44 +0200 |
---|---|---|
committer | Pau Espin Pedrol <pespin@sysmocom.de> | 2018-06-28 17:07:58 +0200 |
commit | a02b71f65ad7829bba0b63c00e8e031119a628d7 (patch) | |
tree | 2225393c7f2cc5b5cc667f4e670ad8643e5fc2a7 /openbsc | |
parent | b7489c59fb6ba610108369bc9526a756a517d199 (diff) |
bsc-nat: find_paging: Check return code of tlv_parse
Change-Id: Ib03681cf91550846af0d487c11cc90b6f700b340
Diffstat (limited to 'openbsc')
-rw-r--r-- | openbsc/src/osmo-bsc_nat/bsc_nat_utils.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat_utils.c b/openbsc/src/osmo-bsc_nat/bsc_nat_utils.c index 5a06d3fd3..85fc7edea 100644 --- a/openbsc/src/osmo-bsc_nat/bsc_nat_utils.c +++ b/openbsc/src/osmo-bsc_nat/bsc_nat_utils.c @@ -331,13 +331,19 @@ int bsc_nat_find_paging(struct msgb *msg, int data_length; const uint8_t *data; struct tlv_parsed tp; + int rc; if (!msg->l3h || msgb_l3len(msg) < 3) { LOGP(DNAT, LOGL_ERROR, "Paging message is too short.\n"); return -1; } - tlv_parse(&tp, gsm0808_att_tlvdef(), msg->l3h + 3, msgb_l3len(msg) - 3, 0, 0); + rc = tlv_parse(&tp, gsm0808_att_tlvdef(), msg->l3h + 3, msgb_l3len(msg) - 3, 0, 0); + if (rc < 0) { + LOGP(DNAT, LOGL_ERROR, "Failed parsing PAGING TLV -- discarding message! %s\n", + osmo_hexdump(msg->l3h, msgb_l3len(msg))); + return -1; + } if (!TLVP_PRESENT(&tp, GSM0808_IE_CELL_IDENTIFIER_LIST)) { LOGP(DNAT, LOGL_ERROR, "No CellIdentifier List inside paging msg.\n"); return -2; |