From 8f419c035b2f3c42a4099cd7813222dbede5e4dc Mon Sep 17 00:00:00 2001 From: Andre Puschmann Date: Sun, 29 Dec 2019 23:38:27 +0100 Subject: [PATCH] fixing snprintf issue where return value was used for length calculation --- srsue/src/stack/rrc/rrc.cc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/srsue/src/stack/rrc/rrc.cc b/srsue/src/stack/rrc/rrc.cc index 5376ffa11..d178f40f5 100644 --- a/srsue/src/stack/rrc/rrc.cc +++ b/srsue/src/stack/rrc/rrc.cc @@ -572,12 +572,13 @@ void rrc::sort_neighbour_cells() neighbour_cells[0]->phy_cell.cell.id, neighbour_cells[0]->get_rsrp()); for (uint32_t i = 1; i < neighbour_cells.size(); i++) { - n += snprintf(&ordered[n], - 512 - n, - " | earfcn=%d, pci=%d, rsrp=%.2f", - neighbour_cells[i]->get_earfcn(), - neighbour_cells[i]->get_pci(), - neighbour_cells[i]->get_rsrp()); + int m = snprintf(&ordered[n], + 512 - n, + " | earfcn=%d, pci=%d, rsrp=%.2f", + neighbour_cells[i]->get_earfcn(), + neighbour_cells[i]->get_pci(), + neighbour_cells[i]->get_rsrp()); + n += m; } rrc_log->info("Neighbours: %s]\n", ordered); } else {