diff options
author | Guy Harris <guy@alum.mit.edu> | 2003-02-21 00:22:45 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2003-02-21 00:22:45 +0000 |
commit | d8629a2747a45b3da776a53639fd2c815a2d3ef0 (patch) | |
tree | b7706ff6a28ebba7437347c46dd2516ecd35efa0 /packet-tcp.c | |
parent | 5ef6684a97ec26d2ecc6e9dd4ce6c804dc487578 (diff) | |
download | wireshark-d8629a2747a45b3da776a53639fd2c815a2d3ef0.tar.gz wireshark-d8629a2747a45b3da776a53639fd2c815a2d3ef0.tar.bz2 wireshark-d8629a2747a45b3da776a53639fd2c815a2d3ef0.zip |
Protect against wraparound when scanning through a bunch of TCP data in
"tcp_dissect_pdus()".
svn path=/trunk/; revision=7179
Diffstat (limited to 'packet-tcp.c')
-rw-r--r-- | packet-tcp.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/packet-tcp.c b/packet-tcp.c index 233073cb73..5c5c2be6fe 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.172 2003/02/18 21:37:53 guy Exp $ + * $Id: packet-tcp.c,v 1.173 2003/02/21 00:22:45 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -1382,6 +1382,7 @@ tcp_dissect_pdus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void (*dissect_pdu)(tvbuff_t *, packet_info *, proto_tree *)) { volatile int offset = 0; + int offset_before; guint length_remaining; guint plen; guint length; @@ -1497,8 +1498,12 @@ tcp_dissect_pdus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, /* * Step to the next PDU. + * Make sure we don't overflow. */ + offset_before = offset; offset += plen; + if (offset <= offset_before) + break; } } |