E212: Check MNC length before trying 3-digits length

Bug: 13935
Change-Id: Ib3f86c7a70d065cf7d5659a2fbc9c34047efcb56
Reviewed-on: https://code.wireshark.org/review/22894
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
This commit is contained in:
Marius Paliga 2017-08-01 10:52:54 +02:00 committed by Pascal Quantin
parent 4e9085696b
commit 6893f7a5c7
1 changed files with 5 additions and 3 deletions

View File

@ -3262,9 +3262,11 @@ dissect_e212_mcc_mnc_in_utf8_address(tvbuff_t *tvb, packet_info *pinfo _U_, prot
/* 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)) {
ws_strtou16(tvb_get_string_enc(wmem_packet_scope(), tvb, offset + 3, 3, ENC_UTF_8),
NULL, &mnc);
long_mnc = TRUE;
if (tvb_reported_length_remaining(tvb, offset + 3) > 2) {
ws_strtou16(tvb_get_string_enc(wmem_packet_scope(), tvb, offset + 3, 3, ENC_UTF_8),
NULL, &mnc);
long_mnc = TRUE;
}
}
proto_tree_add_uint(tree, hf_E212_mcc, tvb, offset, 3, mcc );