diff options
author | Andreas Eversberg <jolly@eversberg.eu> | 2023-11-06 11:16:07 +0100 |
---|---|---|
committer | Andreas Eversberg <jolly@eversberg.eu> | 2023-11-06 11:19:07 +0100 |
commit | 9baa065c8da5ecd96e9a2f2c6d5d1c57ece754b2 (patch) | |
tree | 1ca3626647e196745fb623571f6126a8770c0bc7 | |
parent | 9b81ef5db8045d967aefb96fc8aee820dfa90791 (diff) |
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
-rw-r--r-- | src/osmo-bsc/system_information.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/osmo-bsc/system_information.c b/src/osmo-bsc/system_information.c index 141a720b1..cc2e788d7 100644 --- a/src/osmo-bsc/system_information.c +++ b/src/osmo-bsc/system_information.c @@ -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", |