aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-tcp.c
diff options
context:
space:
mode:
authorAnders Broman <anders.broman@ericsson.com>2010-11-06 21:05:45 +0000
committerAnders Broman <anders.broman@ericsson.com>2010-11-06 21:05:45 +0000
commit0d246c79a9743e2e9af5176f023dda212b103d0d (patch)
treea2df63bc8e29ba41d732b14411042217d88942ad /epan/dissectors/packet-tcp.c
parent796dc8927cc5f1ac17c95c160a99ce2b154ffc24 (diff)
display the the PDU length as "cut short"if it crosses the boundary of the
* packet and no more packets are available. Based on the patch from Alexander Koeppe in https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5285 svn path=/trunk/; revision=34799
Diffstat (limited to 'epan/dissectors/packet-tcp.c')
-rw-r--r--epan/dissectors/packet-tcp.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/epan/dissectors/packet-tcp.c b/epan/dissectors/packet-tcp.c
index 2e23509c56..54ad830f35 100644
--- a/epan/dissectors/packet-tcp.c
+++ b/epan/dissectors/packet-tcp.c
@@ -2025,12 +2025,24 @@ tcp_dissect_pdus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
show_reported_bounds_error(tvb, pinfo, tree);
return;
}
- /*
- * Display the PDU length as a field
- */
- item=proto_tree_add_uint(pinfo->tcp_tree, hf_tcp_pdu_size, tvb, offset, plen, plen);
- PROTO_ITEM_SET_GENERATED(item);
+ /*
+ * Do not display the the PDU length if it crosses the boundary of the
+ * packet and no more packets are available
+ */
+ if ( length_remaining >= plen || pinfo->fd->next != NULL )
+ {
+ /*
+ * Display the PDU length as a field
+ */
+ item=proto_tree_add_uint(pinfo->tcp_tree, hf_tcp_pdu_size,
+ tvb, offset, plen, plen);
+ PROTO_ITEM_SET_GENERATED(item);
+ }else{
+ item = proto_tree_add_text(pinfo->tcp_tree, tvb, offset, -1,
+ "PDU Size: %u cut short at %u",plen,length_remaining);
+ PROTO_ITEM_SET_GENERATED(item);
+ }
/* give a hint to TCP where the next PDU starts