Fix -1 lengths in proto_tree_add_item_ret_string_and_length().
authorEtienne Dechamps <etienne@edechamps.fr>
Sun, 20 Nov 2016 18:37:19 +0000 (18:37 +0000)
committerAlexis La Goutte <alexis.lagoutte@gmail.com>
Mon, 21 Nov 2016 09:52:47 +0000 (09:52 +0000)
Currently, when passing a -1 length to proto_tree_add_item_ret_string_and_length() or
proto_tree_add_item_ret_string(), the -1 length will be passed directly
to the field info. The calculated length should be used instead.

Bug: 13159
Change-Id: I980d18fb9bde3c452e64a8735e62d4830ce53b64
Reviewed-on: https://code.wireshark.org/review/18904
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
epan/proto.c

index 8ddb971298108c5fc57ca217200aba3d7a74b2c2..cfd137d083332044ad326976ad7e120f062f9214 100644 (file)
@@ -2448,7 +2448,7 @@ proto_tree_add_item_ret_string_and_length(proto_tree *tree, int hfindex,
 
        TRY_TO_FAKE_THIS_ITEM(tree, hfinfo->id, hfinfo);
 
-       new_fi = new_field_info(tree, hfinfo, tvb, start, length);
+       new_fi = new_field_info(tree, hfinfo, tvb, start, *lenretval);
 
        proto_tree_set_string(new_fi, value);