From 2e93a8683ca5f644d365380ef55d657598af6c7f Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Thu, 23 Jan 2014 17:09:10 +0100 Subject: bts_model_rsl_chan_act(): Handle tp==NULL case gracefully The PCU may call this function without a valid 'tp' (tlv parsed) pointer, we need to make sure we take this into consideration... --- src/osmo-bts-sysmo/oml.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/osmo-bts-sysmo') diff --git a/src/osmo-bts-sysmo/oml.c b/src/osmo-bts-sysmo/oml.c index dbd5fd01..11222b18 100644 --- a/src/osmo-bts-sysmo/oml.c +++ b/src/osmo-bts-sysmo/oml.c @@ -1555,7 +1555,9 @@ int bts_model_rsl_chan_act(struct gsm_lchan *lchan, struct tlv_parsed *tp) //uint8_t type = *TLVP_VAL(tp, RSL_IE_ACT_TYPE); struct gsm48_chan_desc *cd; - if (TLVP_PRESENT(tp, GSM48_IE_CHANDESC_2) && + /* osmo-pcu calls this without a valid 'tp' parameter, so we + * need to make sure we don't crash here */ + if (tp && TLVP_PRESENT(tp, GSM48_IE_CHANDESC_2) && TLVP_LEN(tp, GSM48_IE_CHANDESC_2) >= sizeof(*cd)) { cd = (struct gsm48_chan_desc *) TLVP_VAL(tp, GSM48_IE_CHANDESC_2); -- cgit v1.2.3