From aff3395f30cdb8a493853eb580e587b4c89fd2d6 Mon Sep 17 00:00:00 2001 From: Roberto Louro Magueta Date: Fri, 23 Dec 2022 15:23:57 +0000 Subject: [PATCH] Fix buffer overflow in nr_csi_im_power_estimation() --- openair1/PHY/NR_UE_TRANSPORT/csi_rx.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/openair1/PHY/NR_UE_TRANSPORT/csi_rx.c b/openair1/PHY/NR_UE_TRANSPORT/csi_rx.c index 6768c8bc37..3387b68e2a 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/csi_rx.c +++ b/openair1/PHY/NR_UE_TRANSPORT/csi_rx.c @@ -773,9 +773,12 @@ int nr_csi_im_power_estimation(const PHY_VARS_NR_UE *ue, for (int sc_idx = 0; sc_idx<4; sc_idx++) { uint16_t sc = sc0_offset + csiim_config_pdu->k_csiim[sc_idx]; + if (sc >= frame_parms->ofdm_symbol_size) { + sc -= frame_parms->ofdm_symbol_size; + } #ifdef NR_CSIIM_DEBUG - LOG_I(NR_PHY, "(ant_rx %i, sc %i) real %i, imag %i\n", ant_rx, rb, rx_signal[sc].r, rx_signal[sc].i); + LOG_I(NR_PHY, "(ant_rx %i, sc %i) real %i, imag %i\n", ant_rx, sc, rx_signal[sc].r, rx_signal[sc].i); #endif sum_re += rx_signal[sc].r;