diff options
author | Jeff Morriss <jeff.morriss.ws@gmail.com> | 2014-04-19 22:20:26 -0400 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2014-04-21 14:43:36 +0000 |
commit | 6f0f6120e368e81b52d4810af6527551ad38b29b (patch) | |
tree | 1ecdd7d14ef49b98859f33c17114303d3e2d33ef /epan/proto.c | |
parent | cc865961c91eae9992b534f72a319a2ababf4d9a (diff) |
Apply the fix for bug 3290 to proto_tree_add_bytes*(): check the item length before trying to fake the item.
This fixes the case described in https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9983
proto_tree_add_bytes_item() and FT_UINT_BYTES both still need work.
Change-Id: Ie421fed9e6dcecbc8b3eed1a57b3032d6ee043e8
Reviewed-on: https://code.wireshark.org/review/1219
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/proto.c')
-rw-r--r-- | epan/proto.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/epan/proto.c b/epan/proto.c index 59df7f4c71..a2757c9d8d 100644 --- a/epan/proto.c +++ b/epan/proto.c @@ -2263,6 +2263,11 @@ proto_tree_add_bytes(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start, { proto_item *pi; header_field_info *hfinfo; + gint item_length; + + PROTO_REGISTRAR_GET_NTH(hfindex, hfinfo); + get_hfi_length(hfinfo, tvb, start, &length, &item_length); + test_length(hfinfo, tvb, start, item_length); TRY_TO_FAKE_THIS_ITEM(tree, hfindex, hfinfo); @@ -2283,6 +2288,11 @@ proto_tree_add_bytes_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb, proto_item *pi; va_list ap; header_field_info *hfinfo; + gint item_length; + + PROTO_REGISTRAR_GET_NTH(hfindex, hfinfo); + get_hfi_length(hfinfo, tvb, start, &length, &item_length); + test_length(hfinfo, tvb, start, item_length); TRY_TO_FAKE_THIS_ITEM(tree, hfindex, hfinfo); @@ -2308,6 +2318,11 @@ proto_tree_add_bytes_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, proto_item *pi; va_list ap; header_field_info *hfinfo; + gint item_length; + + PROTO_REGISTRAR_GET_NTH(hfindex, hfinfo); + get_hfi_length(hfinfo, tvb, start, &length, &item_length); + test_length(hfinfo, tvb, start, item_length); TRY_TO_FAKE_THIS_ITEM(tree, hfindex, hfinfo); |