diff options
author | John Thacker <johnthacker@gmail.com> | 2020-10-28 15:30:12 -0400 |
---|---|---|
committer | Wireshark GitLab Utility <gerald+gitlab-utility@wireshark.org> | 2020-10-28 22:05:17 +0000 |
commit | abf3eaace8cf937b281e2ed5a2cccafb4ec5bf4e (patch) | |
tree | f9f4e85e182edecc846b9eee076e60e29211a503 /epan/tvbuff.c | |
parent | 4ff3c82534e660096675f9d133c091921e7905be (diff) |
Encodings: Add FT_STRINGZ support for GB18030, EUC-KR
Diffstat (limited to 'epan/tvbuff.c')
-rw-r--r-- | epan/tvbuff.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/epan/tvbuff.c b/epan/tvbuff.c index 5bdeb22090..df44f60955 100644 --- a/epan/tvbuff.c +++ b/epan/tvbuff.c @@ -3289,6 +3289,34 @@ tvb_get_t61_stringz(wmem_allocator_t *scope, tvbuff_t *tvb, gint offset, gint *l return get_t61_string(scope, ptr, size); } +static guint8 * +tvb_get_gb18030_stringz(wmem_allocator_t *scope, tvbuff_t *tvb, gint offset, gint *lengthp) +{ + guint size; + const guint8 *ptr; + + size = tvb_strsize(tvb, offset); + ptr = ensure_contiguous(tvb, offset, size); + /* XXX, conversion between signed/unsigned integer */ + if (lengthp) + *lengthp = size; + return get_gb18030_string(scope, ptr, size); +} + +static guint8 * +tvb_get_euc_kr_stringz(wmem_allocator_t *scope, tvbuff_t *tvb, gint offset, gint *lengthp) +{ + guint size; + const guint8 *ptr; + + size = tvb_strsize(tvb, offset); + ptr = ensure_contiguous(tvb, offset, size); + /* XXX, conversion between signed/unsigned integer */ + if (lengthp) + *lengthp = size; + return get_euc_kr_string(scope, ptr, size); +} + guint8 * tvb_get_stringz_enc(wmem_allocator_t *scope, tvbuff_t *tvb, const gint offset, gint *lengthp, const guint encoding) { @@ -3463,6 +3491,14 @@ tvb_get_stringz_enc(wmem_allocator_t *scope, tvbuff_t *tvb, const gint offset, g case ENC_T61: strptr = tvb_get_t61_stringz(scope, tvb, offset, lengthp); break; + + case ENC_GB18030: + strptr = tvb_get_gb18030_stringz(scope, tvb, offset, lengthp); + break; + + case ENC_EUC_KR: + strptr = tvb_get_euc_kr_stringz(scope, tvb, offset, lengthp); + break; } return strptr; |