SI10: Fix uninitialized last_i index

Not only l_bts must be declared outside the for-loop, but also last_i.

This is a fixup of I9dbbd066075f9ccb331616a2b59b46b1b44c8b4c.

Related: CID#330311
Change-Id: Ia10c5e68cb2940d9360d78f606af25bb207ee55f
This commit is contained in:
Andreas Eversberg 2023-11-06 11:16:07 +01:00
parent 9b81ef5db8
commit 9baa065c8d
1 changed files with 2 additions and 3 deletions

View File

@ -1422,7 +1422,7 @@ int gsm_generate_si10(struct gsm48_system_information_type_10 *si10, size_t len,
{
struct bitvec *nbv;
struct gsm_bts *s_bts = conn->lchan->ts->trx->bts, *l_bts = NULL;
int i;
int i, last_i = -1;
bool any_neighbor = false;
int rc;
@ -1447,7 +1447,6 @@ int gsm_generate_si10(struct gsm48_system_information_type_10 *si10, size_t len,
struct gsm_subscriber_connection *c;
unsigned int save_cur_bit;
int16_t arfcn;
int last_i;
arfcn = neigh_list_get_arfcn(s_bts, nbv, i);
/* End of list */
if (arfcn < 0)
@ -1478,7 +1477,7 @@ int gsm_generate_si10(struct gsm48_system_information_type_10 *si10, size_t len,
save_cur_bit = bv.cur_bit;
/* Nth neighbor, so add rest octets with differential cell info. */
LOGP(DRR, LOGL_INFO, "Append cell ID %d to SI 10.\n", n_bts->cell_identity);
OSMO_ASSERT(l_bts);
OSMO_ASSERT(l_bts && last_i >= 0);
rc = si10_rest_octets_encode_other(s_bts, &bv, l_bts, n_bts, last_i, i);
if (rc < 0) {
LOGP(DRR, LOGL_INFO, "Skip cell ID %d, SI 10 would overflow.\n",