From a8ad2b1b9316e28722593c1025876a1aabaea47e Mon Sep 17 00:00:00 2001 From: Philipp Maier Date: Thu, 5 Jan 2023 13:04:21 +0100 Subject: [PATCH] pcu_sock: guard against too many TRX The pcuif only supports a limited but sufficient number of TRXs. When filling in the TRX array in info_ind, we must guard against overflowing the maximum number of TRXs Change-Id: I351080a112f3d3fdf833ee7fa0d77c4cd1d13e42 Related: OS#5198 --- src/osmo-bsc/pcu_sock.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/osmo-bsc/pcu_sock.c b/src/osmo-bsc/pcu_sock.c index 1dcab566f..ab3b7d5d2 100644 --- a/src/osmo-bsc/pcu_sock.c +++ b/src/osmo-bsc/pcu_sock.c @@ -226,6 +226,12 @@ static int pcu_tx_info_ind(struct gsm_bts *bts) trx = gsm_bts_trx_num(bts, i); if (!trx) continue; + if (trx->nr >= ARRAY_SIZE(info_ind->trx)) { + LOG_TRX(trx, DPCU, LOGL_NOTICE, "PCU interface (version %u) " + "cannot handle more than %zu transceivers => skipped\n", + PCU_IF_VERSION, ARRAY_SIZE(info_ind->trx)); + break; + } info_ind->trx[i].hlayer1 = 0x2342; info_ind->trx[i].pdch_mask = 0; info_ind->trx[i].arfcn = trx->arfcn;