From a923c28ede1dd921c324b1e6e65cf91fd3b4ff13 Mon Sep 17 00:00:00 2001 From: Pascal Quantin Date: Mon, 11 Jun 2012 13:54:06 +0000 Subject: [PATCH] Use restricted character string decoding for IA5String type Fixes https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6246 svn path=/trunk/; revision=43203 --- epan/dissectors/packet-per.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/epan/dissectors/packet-per.c b/epan/dissectors/packet-per.c index d7c6c47cae..3bc11b4a7b 100644 --- a/epan/dissectors/packet-per.c +++ b/epan/dissectors/packet-per.c @@ -518,17 +518,6 @@ DEBUG_ENTRY("dissect_per_sequence_of"); } -/* dissect a constrained IA5String that consists of the full ASCII set, - i.e. no FROM stuff limiting the alphabet -*/ -guint32 -dissect_per_IA5String(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index, int min_len, int max_len, gboolean has_extension) -{ - offset=dissect_per_octet_string(tvb, offset, actx, tree, hf_index, min_len, max_len, has_extension, NULL); - - return offset; -} - /* XXX we don't do >64k length strings yet */ static guint32 dissect_per_restricted_character_string_sorted(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index, int min_len, int max_len, gboolean has_extension _U_,const char *alphabet, int alphabet_length, tvbuff_t **value_tvb) @@ -656,7 +645,8 @@ DEBUG_ENTRY("dissect_per_restricted_character_string"); /* ALIGNED PER does not do any remapping of chars if bitsperchar is 8 */ - if(bits_per_char==8){ + /* If alphabet is not provided, do not do any remapping either */ + if((bits_per_char==8) || (alphabet==NULL)){ buf[char_pos]=val; } else { if (val < alphabet_length){ @@ -713,6 +703,18 @@ dissect_per_restricted_character_string(tvbuff_t *tvb, guint32 offset, asn1_ctx_ return dissect_per_restricted_character_string_sorted(tvb, offset, actx, tree, hf_index, min_len, max_len, has_extension, alphabet_ptr, alphabet_length, value_tvb); } +/* dissect a constrained IA5String that consists of the full ASCII set, + i.e. no FROM stuff limiting the alphabet +*/ +guint32 +dissect_per_IA5String(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index, int min_len, int max_len, gboolean has_extension) +{ + offset=dissect_per_restricted_character_string_sorted(tvb, offset, actx, tree, hf_index, min_len, max_len, has_extension, + NULL, 128, NULL); + + return offset; +} + guint32 dissect_per_NumericString(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index, int min_len, int max_len, gboolean has_extension) {