From 1e14bee4f39ecfed97653436e8ea562e86d91b2d Mon Sep 17 00:00:00 2001 From: Dong Anyuan Date: Thu, 20 Jun 2019 11:15:26 +0900 Subject: [PATCH] Fix Coverity Scan CID 261548 (Overrunning array eutra_bandtable of 48 24-byte elements at element index 48 (byte offset 1152) using index i (which evaluates to 48).) --- openair2/LAYER2/MAC/config.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/openair2/LAYER2/MAC/config.c b/openair2/LAYER2/MAC/config.c index 669f3cf1fe..102d273e04 100644 --- a/openair2/LAYER2/MAC/config.c +++ b/openair2/LAYER2/MAC/config.c @@ -205,6 +205,8 @@ uint32_t from_earfcn(int eutra_bandP, uint32_t dl_earfcn) { for (i = 0; i < BANDTABLE_SIZE && eutra_bandtable[i].band != eutra_bandP; i++); + AssertFatal(i < BANDTABLE_SIZE, "i %d >= BANDTABLE_SIZE %ld\n", i, BANDTABLE_SIZE); + return (eutra_bandtable[i].dl_min + (dl_earfcn - (eutra_bandtable[i].N_OFFs_DL / 10))) * 100000; } @@ -1283,4 +1285,4 @@ void eNB_Config_Local_DRX( LOG_E(MAC, "Error in local DRX configuration, the drx retransmission timer value specified is unknown\n"); break; } -} \ No newline at end of file +}