aboutsummaryrefslogtreecommitdiffstats
path: root/epan/tvbuff.c
diff options
context:
space:
mode:
authorAndersBroman <a.broman58@gmail.com>2021-05-20 09:27:53 +0000
committerAndersBroman <a.broman58@gmail.com>2021-05-20 09:27:53 +0000
commit754cce9531ed22494a35a6707dcb29d601946ec7 (patch)
tree27d8fb2763c742c951187884b0e20ff3bb32f33a /epan/tvbuff.c
parent34ae07e180266431d49e7899a561cd7360f7ee5b (diff)
Add ENC_APN_STR to handle APN strings
Diffstat (limited to 'epan/tvbuff.c')
-rw-r--r--epan/tvbuff.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/epan/tvbuff.c b/epan/tvbuff.c
index fce3cb8c2d..0c26a2f9f0 100644
--- a/epan/tvbuff.c
+++ b/epan/tvbuff.c
@@ -1630,6 +1630,7 @@ 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;
default:
@@ -3092,6 +3093,23 @@ tvb_get_string_enc(wmem_allocator_t *scope, tvbuff_t *tvb, const gint offset,
case ENC_EUC_KR:
strptr = tvb_get_euc_kr_string(scope, tvb, offset, length);
break;
+ case ENC_APN_STR:
+ {
+ int name_len, tmp;
+
+ if (length > 0) {
+ name_len = tvb_get_guint8(tvb, offset);
+ strptr = tvb_get_string_enc(wmem_packet_scope(), tvb, offset + 1, length - 1, ENC_ASCII);
+ for (;;) {
+ if (name_len >= length - 1)
+ break;
+ tmp = name_len;
+ name_len = name_len + strptr[tmp] + 1;
+ strptr[tmp] = '.';
+ }
+ }
+ }
+ break;
}
return strptr;
}