From bdfb4088574ba4b8497edb15ec4aa01c93442282 Mon Sep 17 00:00:00 2001 From: Andre Puschmann Date: Mon, 22 Apr 2019 11:33:20 +0200 Subject: [PATCH] fix uninitialized loop counter --- srsenb/src/upper/rrc.cc | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/srsenb/src/upper/rrc.cc b/srsenb/src/upper/rrc.cc index c5648c44e..ff8740cbe 100644 --- a/srsenb/src/upper/rrc.cc +++ b/srsenb/src/upper/rrc.cc @@ -1917,13 +1917,12 @@ bool rrc::ue::select_security_algorithms() { bool enc_algo_found = false; bool integ_algo_found = false; bool zero_vector = true; - int i = 0; - for (i = 0; i < srslte::CIPHERING_ALGORITHM_ID_N_ITEMS; i++) { + for (int i = 0; i < srslte::CIPHERING_ALGORITHM_ID_N_ITEMS; i++) { switch (parent->cfg.eea_preference_list[i]) { case srslte::CIPHERING_ALGORITHM_ID_EEA0: // “all bits equal to 0” – UE supports no other algorithm than EEA0, zero_vector = true; - for (int j; j < LIBLTE_S1AP_ENCRYPTIONALGORITHMS_BIT_STRING_LEN; j++) { + for (int j = 0; j < LIBLTE_S1AP_ENCRYPTIONALGORITHMS_BIT_STRING_LEN; j++) { if (security_capabilities.encryptionAlgorithms.buffer[j]) { zero_vector = false; } @@ -1961,13 +1960,12 @@ bool rrc::ue::select_security_algorithms() { } } - for (i = 0; i < srslte::INTEGRITY_ALGORITHM_ID_N_ITEMS; i++) { + for (int i = 0; i < srslte::INTEGRITY_ALGORITHM_ID_N_ITEMS; i++) { switch (parent->cfg.eia_preference_list[i]) { case srslte::INTEGRITY_ALGORITHM_ID_EIA0: // “all bits equal to 0” – UE supports no other algorithm than EEA0, zero_vector = true; - for (int j; j < LIBLTE_S1AP_INTEGRITYPROTECTIONALGORITHMS_BIT_STRING_LEN; - j++) { + for (int j = 0; j < LIBLTE_S1AP_INTEGRITYPROTECTIONALGORITHMS_BIT_STRING_LEN; j++) { if (security_capabilities.integrityProtectionAlgorithms.buffer[j]) { zero_vector = false; }