aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2018-06-28 16:34:44 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2018-06-28 17:07:58 +0200
commita02b71f65ad7829bba0b63c00e8e031119a628d7 (patch)
tree2225393c7f2cc5b5cc667f4e670ad8643e5fc2a7 /openbsc
parentb7489c59fb6ba610108369bc9526a756a517d199 (diff)
bsc-nat: find_paging: Check return code of tlv_parse
Diffstat (limited to 'openbsc')
-rw-r--r--openbsc/src/osmo-bsc_nat/bsc_nat_utils.c8
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;