diff options
author | Vadim Yanitskiy <vyanitskiy@sysmocom.de> | 2021-06-04 03:01:06 +0200 |
---|---|---|
committer | laforge <laforge@osmocom.org> | 2021-06-04 19:39:58 +0000 |
commit | ff5ceeadb8e9576e94e99e6f4759693e63fec2e7 (patch) | |
tree | f798640fa1f7f22af662932734afa5265c549cdd /src/osmo-bsc/bsc_vty.c | |
parent | 8971d6b98f3c350523f4ac2fee0d2e3e4fffe8e3 (diff) |
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
Diffstat (limited to 'src/osmo-bsc/bsc_vty.c')
-rw-r--r-- | src/osmo-bsc/bsc_vty.c | 4 |
1 files changed, 4 insertions, 0 deletions
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) { |