aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Kaiser <wireshark@kaiser.cx>2016-12-23 00:20:56 +0100
committerMichael Mann <mmann78@netscape.net>2016-12-23 12:40:05 +0000
commita1ecbc92b028203bd08db18585471050baf712f4 (patch)
treed44d838df866ef1f259f77ac5f51e907493fa8ea
parent46caff30c8234d011bdde44d051e405971cfa9d9 (diff)
make proto_tree_add_bitmask_value_with_flags() work for tvb==NULL
proto_tree_add_bitmask_value_with_flags() eventually calls proto_tree_add_XXX() for the main hf and for the field elements. These functions work for tvb==NULL if the length is also set to 0. Otherwise, we'll end up in proto_tree_add_pi(), get_hfi_length() and run into the DISSECTOR_ASSERT() there. proto_tree_add_bitmask_value...() are meant for cases where the data is passed directly and not read from a tvb. If tvb==NULL, set our length to 0 instead of using the field length from the main hf. Change-Id: Ia55b068e9842ba4a1ae8be8692320a8e93ea8631 Reviewed-on: https://code.wireshark.org/review/19394 Reviewed-by: Martin Kaiser <wireshark@kaiser.cx> Petri-Dish: Martin Kaiser <wireshark@kaiser.cx> Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
-rw-r--r--epan/proto.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/epan/proto.c b/epan/proto.c
index ae260f72f2..e00f16b5ef 100644
--- a/epan/proto.c
+++ b/epan/proto.c
@@ -9839,7 +9839,9 @@ proto_tree_add_bitmask_value_with_flags(proto_tree *parent_tree, tvbuff_t *tvb,
PROTO_REGISTRAR_GET_NTH(hf_hdr,hf);
DISSECTOR_ASSERT_FIELD_TYPE_IS_INTEGRAL(hf);
- len = ftype_length(hf->type);
+ /* the proto_tree_add_uint/_uint64() calls below
+ will fail if tvb==NULL and len!=0 */
+ len = tvb ? ftype_length(hf->type) : 0;
if (parent_tree) {
if (len <= 4)