aboutsummaryrefslogtreecommitdiffstats
path: root/epan/proto.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2019-05-24 13:53:39 -0700
committerGuy Harris <guy@alum.mit.edu>2019-05-24 21:26:16 +0000
commit1fd3003a6d445047e99d13f6804b5b84425a7a46 (patch)
tree2fd8f5b2b79740accc35d136c7a151639f0d7c5a /epan/proto.c
parentdd4c9877560774c9f07c454028027539a562fe1a (diff)
"Zigbee" encoding is not a character encoding or an integer encoding.
It's a rule for interpretation of the length field of counted-string and counted-octet-string fields. This means it's 1) not a general rule for interpreting integers and 2) not a character encoding, as it also applies to octet strings and, even for character strings, it's *orthogonal* to the character encoding. Therefore, it should *not* be one of the character encoding values; it should be a bit flag. Make it so. This means that 1) a character encoding can be specified for Zigbee Cluster Library strings (they appear to have multiple character encodings possible); 2) the test of it that tested it as if it were a flag will no longer get confused by character encodings that set one or more of the bits in the old encoding value; 3) you don't have to special-case the encoding value passed to get_uint_value(). Put in a comment emphasizing that values that aren't character encodings should *not* be placed in the set of character encodings. Change-Id: I8f50aaee8ca60b0781044287e9b38111de38c81f Reviewed-on: https://code.wireshark.org/review/33341 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'epan/proto.c')
-rw-r--r--epan/proto.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/epan/proto.c b/epan/proto.c
index 17b241d024..1d860c7f3b 100644
--- a/epan/proto.c
+++ b/epan/proto.c
@@ -1664,11 +1664,7 @@ get_uint_string_value(wmem_allocator_t *scope, proto_tree *tree,
const guint8 *value;
/* I believe it's ok if this is called with a NULL tree */
- if (encoding & ENC_ZIGBEE) {
- n = get_uint_value(tree, tvb, start, length, encoding);
- } else {
- n = get_uint_value(tree, tvb, start, length, encoding & ~ENC_CHARENCODING_MASK);
- }
+ n = get_uint_value(tree, tvb, start, length, encoding & ~ENC_CHARENCODING_MASK);
value = tvb_get_string_enc(scope, tvb, start + length, n, encoding);
length += n;
*ret_length = length;
@@ -5608,11 +5604,7 @@ get_full_length(header_field_info *hfinfo, tvbuff_t *tvb, const gint start,
break;
case FT_UINT_STRING:
- if (encoding & ENC_ZIGBEE) {
- n = get_uint_value(NULL, tvb, start, length, encoding);
- } else {
- n = get_uint_value(NULL, tvb, start, length, encoding & ~ENC_CHARENCODING_MASK);
- }
+ n = get_uint_value(NULL, tvb, start, length, encoding & ~ENC_CHARENCODING_MASK);
item_length += n;
break;