aboutsummaryrefslogtreecommitdiffstats
path: root/packet-tcp.c
diff options
context:
space:
mode:
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2003-03-05 07:17:50 +0000
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2003-03-05 07:17:50 +0000
commit772319fde0ed56418355d93a71edd3b7e60180f1 (patch)
treee20f09b7846e741997fb1b8469d5321879f09516 /packet-tcp.c
parent2316ffdb45736c3cd41e2812425d4e4755be10fa (diff)
Use the reported length, not the captured length, as the fragment length
when doing reassembly. In some additional places, use "tvb_bytes_exist()" to check whether we have enough data to do reassembly, rather than checking to see if the frame is short (it might be short but we might still have enough data to do reassembly). In DCE RPC, use the fragment length from the header as the number of bytes of fragment data. There's no need to check "pinfo->fragmented" before doing reassembly in the DCERPC-over-SMB-pipes code - either we have all the data or we don't. In SNA and WTP reassembly, add a check to make sure we have all the data to be reassembled. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@7282 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'packet-tcp.c')
-rw-r--r--packet-tcp.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/packet-tcp.c b/packet-tcp.c
index 44e33b6c3b..7ec1fdaf00 100644
--- a/packet-tcp.c
+++ b/packet-tcp.c
@@ -1,7 +1,7 @@
/* packet-tcp.c
* Routines for TCP packet disassembly
*
- * $Id: packet-tcp.c,v 1.185 2003/03/04 04:36:44 sharpe Exp $
+ * $Id: packet-tcp.c,v 1.186 2003/03/05 07:17:50 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -1829,7 +1829,6 @@ dissect_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
guint bpos;
guint optlen;
guint32 nxtseq;
- guint len;
guint reported_len;
vec_t cksum_vec[4];
guint32 phdr[2];
@@ -1896,7 +1895,6 @@ dissect_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
tcph->th_hlen = hi_nibble(th_off_x2) * 4; /* TCP header length, in bytes */
reported_len = tvb_reported_length(tvb);
- len = tvb_length(tvb);
/* Compute the length of data in this segment. */
tcph->th_seglen = reported_len - tcph->th_hlen;
@@ -2000,7 +1998,7 @@ dissect_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
*/
pinfo->can_desegment = 0;
th_sum = tvb_get_ntohs(tvb, offset + 16);
- if (!pinfo->fragmented && len >= reported_len) {
+ if (!pinfo->fragmented && tvb_bytes_exist(tvb, 0, reported_len)) {
/* The packet isn't part of an un-reassembled fragmented datagram
and isn't truncated. This means we have all the data, and thus
can checksum it and, unless it's being returned in an error
@@ -2034,7 +2032,7 @@ dissect_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
g_assert_not_reached();
break;
}
- cksum_vec[3].ptr = tvb_get_ptr(tvb, offset, len);
+ cksum_vec[3].ptr = tvb_get_ptr(tvb, offset, reported_len);
cksum_vec[3].len = reported_len;
computed_cksum = in_cksum(&cksum_vec[0], 4);
if (computed_cksum == 0) {