Use ENC_APN_STR in one more place.

This commit is contained in:
Anders Broman 2021-05-20 12:58:06 +02:00 committed by Wireshark GitLab Utility
parent f54221b579
commit 31ca47eafc
2 changed files with 7 additions and 17 deletions

View File

@ -5123,25 +5123,13 @@ de_nas_5gs_cmn_dnn(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo,
{
guint32 curr_offset;
guint curr_len;
guint8 *str;
proto_item *pi;
curr_offset = offset;
/* A DNN value field contains an APN as defined in 3GPP TS 23.003 */
str = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, len, ENC_ASCII | ENC_NA);
pi = proto_tree_add_item(tree, hf_nas_5gs_cmn_dnn, tvb, curr_offset, len, ENC_APN_STR | ENC_NA);
curr_len = 0;
while (curr_len < len)
{
guint step = str[curr_len];
str[curr_len] = '.';
curr_len += step + 1;
}
/* Highlight bytes including the first length byte */
pi = proto_tree_add_string(tree, hf_nas_5gs_cmn_dnn, tvb, curr_offset, len, str + 1);
if (len > 100) {
expert_add_info(pinfo, pi, &ei_nas_5gs_dnn_too_long);
}

View File

@ -1630,11 +1630,11 @@ validate_single_byte_ascii_encoding(const guint encoding)
case ENC_KEYPAD_ABC_TBCD:
case ENC_KEYPAD_BC_TBCD:
case ENC_ETSI_TS_102_221_ANNEX_A:
case ENC_APN_STR:
REPORT_DISSECTOR_BUG("Invalid string encoding type passed to tvb_get_string_XXX");
break;
case ENC_APN_STR:
REPORT_DISSECTOR_BUG("Invalid string encoding type passed to tvb_get_string_XXX");
break;
default:
break;
break;
}
/* make sure something valid was set */
if (enc == 0)
@ -3107,6 +3107,8 @@ tvb_get_string_enc(wmem_allocator_t *scope, tvbuff_t *tvb, const gint offset,
name_len = name_len + strptr[tmp] + 1;
strptr[tmp] = '.';
}
} else {
strptr = (char*)"";
}
}
break;