From 416ccd18c4be6bdadb1b72da9aa125ebfd006afd Mon Sep 17 00:00:00 2001 From: Pascal Quantin Date: Tue, 7 Jul 2020 19:48:46 +0200 Subject: E212: allow to decode 5 digits long short IMSI used in MAP messages Bug: 16676 Change-Id: I8ba5bce3ec3a63f3c95ebb58ffdbe54d3546a96a Reviewed-on: https://code.wireshark.org/review/37775 Reviewed-by: Pascal Quantin Petri-Dish: Pascal Quantin Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman --- epan/dissectors/packet-e212.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'epan/dissectors/packet-e212.c') diff --git a/epan/dissectors/packet-e212.c b/epan/dissectors/packet-e212.c index 43bec91436..82a4c11172 100644 --- a/epan/dissectors/packet-e212.c +++ b/epan/dissectors/packet-e212.c @@ -3143,12 +3143,12 @@ dissect_e212_mcc_mnc_in_address(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t mnc = 10 * mnc1 + mnc2; /* Try to match the MCC and 2 digits MNC with an entry in our list of operators */ - if (!try_val_to_str_ext(mcc * 100 + mnc, &mcc_mnc_2digits_codes_ext)) { + if (!try_val_to_str_ext(mcc * 100 + mnc, &mcc_mnc_2digits_codes_ext) && mnc3 != 0xf) { mnc = 10 * mnc + mnc3; long_mnc = TRUE; } - item = proto_tree_add_uint(tree, hf_E212_mcc , tvb, start_offset, 2, mcc ); + item = proto_tree_add_uint(tree, hf_E212_mcc , tvb, start_offset, 2, mcc); if (((mcc1 > 9) || (mcc2 > 9) || (mcc3 > 9)) & (mcc_mnc != 0xffffff)) expert_add_info(pinfo, item, &ei_E212_mcc_non_decimal); @@ -3235,7 +3235,7 @@ dissect_e212_mcc_mnc_high_nibble(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tr mnc = 10 * mnc1 + mnc2; /* Try to match the MCC and 2 digits MNC with an entry in our list of operators */ - if (!try_val_to_str_ext(mcc * 100 + mnc, &mcc_mnc_2digits_codes_ext)) { + if (!try_val_to_str_ext(mcc * 100 + mnc, &mcc_mnc_2digits_codes_ext) && mnc3 != 0xf) { mnc = 10 * mnc + mnc3; long_mnc = TRUE; } @@ -3309,8 +3309,10 @@ is_imsi_string_valid(const gchar *imsi_str) /* According to TS 23.003 2.2 and 2.3, the number of digits in IMSI shall not exceed 15. * Even if in the reality imsis are always 14 or 15 digits long, the standard doesn't say * anything about minimum length, except for the fact that they shall have a valid MCC - * (3 digits long), a valid MNC (2 or 3 digits long) and a MSIN (at least 1 digit)*/ - if (len < 6 || len > 15 || strchr(imsi_str, '?')) { + * (3 digits long), a valid MNC (2 or 3 digits long) and a MSIN (at least 1 digit). + * As the dissector actually only decodes the MCC and MNC, allow to decode a + short IMSI (without MSIN) as used by MAP messages */ + if (len < 5 || len > 15 || strchr(imsi_str, '?')) { return FALSE; } return TRUE; -- cgit v1.2.3