There's no need to get the parent of an item we're passing into

proto_tree_move_item(): that function will expects the item, not its parent.

This avoids dissector bugs such as the one reported in
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6768 :

** (process:745): WARNING **: Dissector bug, protocol RTP, in packet 82:
proto.c:4273: failed assertion "fixed_item->parent == tree"

svn path=/trunk/; revision=41021
This commit is contained in:
Jeff Morriss 2012-02-14 02:43:58 +00:00
parent ce751db87c
commit 0cb2500e45
2 changed files with 2 additions and 2 deletions

View File

@ -2106,7 +2106,7 @@ static void desegment_iax(tvbuff_t *tvb, packet_info *pinfo, proto_tree *iax2_tr
/* this nargery is to insert the fragment tree into the main tree
* between the IAX protocol entry and the subdissector entry */
show_fragment_tree(fd_head, &iax2_fragment_items, tree, pinfo, next_tvb, &frag_tree_item);
iax_tree_item = proto_item_get_parent( proto_tree_get_parent( iax2_tree ));
iax_tree_item = proto_tree_get_parent( iax2_tree );
if( frag_tree_item && iax_tree_item )
proto_tree_move_item( tree, iax_tree_item, frag_tree_item );

View File

@ -924,7 +924,7 @@ dissect_rtp_data( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
/* this nargery is to insert the fragment tree into the main tree
* between the RTP protocol entry and the subdissector entry */
show_fragment_tree(fd_head, &rtp_fragment_items, tree, pinfo, newtvb, &frag_tree_item);
rtp_tree_item = proto_item_get_parent( proto_tree_get_parent( rtp_tree ));
rtp_tree_item = proto_tree_get_parent( rtp_tree );
if( frag_tree_item && rtp_tree_item )
proto_tree_move_item( tree, rtp_tree_item, frag_tree_item );