summaryrefslogtreecommitdiffstats
path: root/src/gsm/gsm0808_utils.c
diff options
context:
space:
mode:
authorStefan Sperling <ssperling@sysmocom.de>2018-03-14 18:38:41 +0100
committerStefan Sperling <ssperling@sysmocom.de>2018-03-14 18:38:41 +0100
commit2873bf1f331dc07e6c92b4f6a0b45f26683a0f0b (patch)
treecdd1a5adcc230c0c5b4c044f3c9ed40c6979b87d /src/gsm/gsm0808_utils.c
parent11a4d9dd91216fe353e94bfdbbab53bc4f891c0d (diff)
fix a cell identifier parsing bug in libosmocore
Global and LAI+LAC cell IDs were being misparsed due to an off-by-one. This code was incorrectly converted from osmo-bsc, where an additional offset of one byte was needed to skip the cell identifier field. In libosmocore, these parsing routines receive a buffer pointer which is already positioned at the start of the cell identifier field. Change-Id: I7f3e8ace26176e9cbfe2542961d2a95662aa4d97 Related: OS#2847
Diffstat (limited to 'src/gsm/gsm0808_utils.c')
-rw-r--r--src/gsm/gsm0808_utils.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/gsm/gsm0808_utils.c b/src/gsm/gsm0808_utils.c
index a07ef0ec..e12a9689 100644
--- a/src/gsm/gsm0808_utils.c
+++ b/src/gsm/gsm0808_utils.c
@@ -703,7 +703,7 @@ static int parse_cell_id_global_list(struct osmo_cell_global_id *id_list, const
if (i >= GSM0808_CELL_ID_LIST2_MAXLEN)
return -ENOSPC;
id = &id_list[i];
- lai_offset = 1 + i * elemlen;
+ lai_offset = i * elemlen;
if (decode_lai(&data[lai_offset], &id->lai.plmn.mcc, &id->lai.plmn.mnc, &id->lai.lac) != 0)
return -EINVAL;
ci_be = (uint16_t *)(&data[lai_offset + sizeof(struct gsm48_loc_area_id)]);
@@ -775,7 +775,7 @@ static int parse_cell_id_lai_and_lac(struct osmo_location_area_id *id_list, cons
if (i >= GSM0808_CELL_ID_LIST2_MAXLEN)
return -ENOSPC;
id = &id_list[i];
- if (decode_lai(&data[1 + i * elemlen], &id->plmn.mcc, &id->plmn.mnc, &id->lac) != 0)
+ if (decode_lai(&data[i * elemlen], &id->plmn.mcc, &id->plmn.mnc, &id->lac) != 0)
return -EINVAL;
*consumed += elemlen;
remain -= elemlen;