From dd9fb84b5844aacafd65888e3da28321613cb01e Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Tue, 16 Feb 2021 20:21:22 +0100 Subject: sgsn: Fix regression regarding g_pars.bssgp.cell_id[] array overflow This was introduced in I7d859fd710dba96eb9b46c428243281183e1be12 and caused Iu related TTCN3 tests to fail with: SGSN_Tests.ttcn:771 Dynamic test case error: Index overflow in a value of type @SGSN_Tests.BssgpCellIds: The index is 3, but the value has only 3 elements. Change-Id: Iaae0015f5e7c7eabc426add91b5de1b63bf6d9f6 --- sgsn/SGSN_Tests.ttcn | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sgsn/SGSN_Tests.ttcn b/sgsn/SGSN_Tests.ttcn index c6e22ccc..b79aae40 100644 --- a/sgsn/SGSN_Tests.ttcn +++ b/sgsn/SGSN_Tests.ttcn @@ -768,7 +768,9 @@ function f_upd_ptmsi_and_tlli(OCT4 p_tmsi, integer ran_index := 0) runs on BSSGP function f_process_attach_accept(PDU_GMM_AttachAccept aa, integer ran_index := 0) runs on BSSGP_ConnHdlr { /* mandatory IE */ var hexstring aa_plmn := f_RAI_to_plmn_hexstr(aa.routingAreaIdentification); - if (not (g_pars.bssgp_cell_id[ran_index].ra_id.lai.mcc_mnc == aa_plmn)) { + /* we cannot use ran_index here, as it would overflow the cell_id object, since ran_idx > NUM_GB + * indicates an Iu RAN connection. All cells are expected to run the same MCC/MNC anyway... */ + if (not (g_pars.bssgp_cell_id[0].ra_id.lai.mcc_mnc == aa_plmn)) { setverdict(fail, "mismatching PLMN in Attach Accept: " & hex2str(aa_plmn) & "; expected " & hex2str(g_pars.bssgp_cell_id[ran_index].ra_id.lai.mcc_mnc)); mtc.stop; -- cgit v1.2.3