From 442843e276982c95131ed790c9ed95e48bbbb1e4 Mon Sep 17 00:00:00 2001 From: Francisco Paisana Date: Mon, 14 Dec 2020 12:16:54 +0000 Subject: [PATCH] enb metric bound check. Fix of heap-buffer overflow issue --- srsenb/src/metrics_stdout.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/srsenb/src/metrics_stdout.cc b/srsenb/src/metrics_stdout.cc index db05d0bf7..75d1be9d2 100644 --- a/srsenb/src/metrics_stdout.cc +++ b/srsenb/src/metrics_stdout.cc @@ -89,8 +89,7 @@ void metrics_stdout::set_metrics(const enb_metrics_t& metrics, const uint32_t pe for (size_t i = 0; i < metrics.stack.rrc.ues.size(); i++) { // make sure we have stats for MAC and PHY layer too - if (metrics.stack.mac.ues.size() == 0 || metrics.phy.size() == 0 || i > metrics.stack.mac.ues.size() || - i > metrics.phy.size()) { + if (i >= metrics.stack.mac.ues.size() || i >= metrics.phy.size()) { break; } if (metrics.stack.mac.ues[i].tx_errors > metrics.stack.mac.ues[i].tx_pkts) {