summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/stkutil.c33
1 files changed, 23 insertions, 10 deletions
diff --git a/src/stkutil.c b/src/stkutil.c
index dda9db57..8ac1dba4 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -3492,14 +3492,8 @@ static gboolean build_dataobj_location_info(struct stk_tlv_builder *tlv,
unsigned char tag = STK_DATA_OBJECT_TYPE_LOCATION_INFO;
guint8 mccmnc[3];
- if (li->mcc[0] == 0)
- /*
- * "If no location information is available for an access
- * technology, the respective data object shall have
- * length zero."
- */
- return stk_tlv_builder_open_container(tlv, cr, tag, FALSE) &&
- stk_tlv_builder_close_container(tlv);
+ if (li->mcc[0] == '\0')
+ return TRUE;
sim_encode_mcc_mnc(mccmnc, li->mcc, li->mnc);
@@ -3532,6 +3526,15 @@ static gboolean build_dataobj_location_info(struct stk_tlv_builder *tlv,
return stk_tlv_builder_close_container(tlv);
}
+static gboolean build_empty_dataobj_location_info(struct stk_tlv_builder *tlv,
+ const void *data, gboolean cr)
+{
+ unsigned char tag = STK_DATA_OBJECT_TYPE_LOCATION_INFO;
+
+ return stk_tlv_builder_open_container(tlv, cr, tag, FALSE) &&
+ stk_tlv_builder_close_container(tlv);
+}
+
/* Described in TS 102.223 Section 8.20
*
* See format note in parse_dataobj_imei.
@@ -4036,12 +4039,22 @@ static gboolean build_local_info(struct stk_tlv_builder *builder,
NULL) != TRUE)
return FALSE;
- for (i = 0; i < info->location_infos.access_techs.length; i++)
+ for (i = 0; i < info->location_infos.access_techs.length; i++) {
+ dataobj_writer location = build_dataobj_location_info;
+ /*
+ * "If no location information is available for an
+ * access technology, the respective data object
+ * shall have length zero."
+ */
+ if (info->location_infos.locations[i].mcc[0] == '\0')
+ location = build_empty_dataobj_location_info;
+
if (build_dataobj(builder,
- build_dataobj_location_info,
+ location,
0, &info->location_infos.locations[i],
NULL) != TRUE)
return FALSE;
+ }
return TRUE;