From ff5ceeadb8e9576e94e99e6f4759693e63fec2e7 Mon Sep 17 00:00:00 2001 From: Vadim Yanitskiy Date: Fri, 4 Jun 2021 03:01:06 +0200 Subject: VTY: fix NULL-pointer dereference in lchan_act_single() Without this guard, a command like this can crash osmo-bsc: OsmoBSC# bts 0 trx 0 timeslot 0 sub-slot 0 activate fr when timeslot 0 is configured as non-combined 'CCCH'. Change-Id: I0197a6a2595ff9dade58e37383d44d2df3b03288 CLoses: OS#5170 --- src/osmo-bsc/bsc_vty.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/osmo-bsc/bsc_vty.c') diff --git a/src/osmo-bsc/bsc_vty.c b/src/osmo-bsc/bsc_vty.c index 5b1f50314..5bd27fc12 100644 --- a/src/osmo-bsc/bsc_vty.c +++ b/src/osmo-bsc/bsc_vty.c @@ -6060,6 +6060,10 @@ static int lchan_act_single(struct vty *vty, struct gsm_lchan *lchan, const char if (activate) { LOG_LCHAN(lchan, LOGL_NOTICE, "attempt from VTY to activate lchan %s with codec %s\n", gsm_lchan_name(lchan), codec_str); + if (!lchan->fi) { + vty_out(vty, "%% Cannot activate: Channel not initialized%s", VTY_NEWLINE); + return CMD_WARNING; + } int lchan_t; if (lchan->fi->state != LCHAN_ST_UNUSED) { -- cgit v1.2.3