diff options
author | Guy Harris <guy@alum.mit.edu> | 2000-08-06 07:22:38 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2000-08-06 07:22:38 +0000 |
commit | 61aefd7470ac7ff134dfa3245033f6fabaae6285 (patch) | |
tree | 15fd7095c9d57da2f1ec8b38841613236c1a1740 /packet-socks.c | |
parent | 10fe2ebd843b25c2295ac19c8e48cf353d45f165 (diff) | |
download | wireshark-61aefd7470ac7ff134dfa3245033f6fabaae6285.tar.gz wireshark-61aefd7470ac7ff134dfa3245033f6fabaae6285.tar.bz2 wireshark-61aefd7470ac7ff134dfa3245033f6fabaae6285.zip |
Don't use "fd->pkt_len" when checking to see if you've run off the end
of the packet, use "pi.captured_len" - "fd->pkt_len" may include data
that isn't in the capture, due to a short snapshot length.
Don't use "fd->cap_len" when checking to see if you've run off the end
of the packe, use "pi.captured_len" - "fd->cap_len" isn't adjusted to
reflect any length fields, but "pi.captured_len" is (removing, for
example, Ethernet padding from the packet).
Use "END_OF_FRAME" rather than "pi.captured_len - offset", to make it a
bit clearer what's being done.
In the V.120 dissector, use "tvb_length()" when adding the top-level
protocol tree entry for V.120, as it's a tvbuffified dissector.
svn path=/trunk/; revision=2214
Diffstat (limited to 'packet-socks.c')
-rw-r--r-- | packet-socks.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/packet-socks.c b/packet-socks.c index c75f6271eb..62faa64703 100644 --- a/packet-socks.c +++ b/packet-socks.c @@ -2,7 +2,7 @@ * Routines for socks versions 4 &5 packet dissection * Copyright 2000, Jeffrey C. Foster <jfoste@woodward.com> * - * $Id: packet-socks.c,v 1.5 2000/05/31 05:07:48 guy Exp $ + * $Id: packet-socks.c,v 1.6 2000/08/06 07:22:38 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -83,7 +83,7 @@ -#define CHECK_PACKET_LENGTH(X) if ((offset+X) > fd->cap_len){ \ +#define CHECK_PACKET_LENGTH(X) if ((offset+X) > pi.captured_len){ \ proto_tree_add_text(tree, NullTVB, offset, 0, "*** FRAME TOO SHORT ***"); \ return; } @@ -233,7 +233,7 @@ static int display_string( const u_char *pd, int offset, frame_data *fd, char temp[ 256]; int length = GBYTE( pd, offset); - if ((offset + 8) > fd->cap_len){ + if ((offset + 8) > pi.captured_len){ proto_tree_add_text(tree, NullTVB, offset, 0, "*** FRAME TOO SHORT ***"); return 0; } @@ -305,7 +305,7 @@ static int display_address( const u_char *pd, int offset, ++offset; if ( a_type == 1){ /* IPv4 address */ - if ( (offset + 4) > fd->cap_len) + if ( (offset + 4) > pi.captured_len) proto_tree_add_text(tree, NullTVB, offset, 0, "*** FRAME TOO SHORT ***"); proto_tree_add_ipv4( tree, hf_socks_ip_dst, NullTVB, offset, @@ -318,7 +318,7 @@ static int display_address( const u_char *pd, int offset, "Remote name"); } else if ( a_type == 4){ /* IPv6 address */ - if ((offset + 16) > fd->cap_len) + if ((offset + 16) > pi.captured_len) proto_tree_add_text(tree, NullTVB, offset, 0, "*** FRAME TOO SHORT ***"); proto_tree_add_ipv6( tree, hf_socks_ip6_dst, NullTVB, offset, @@ -739,7 +739,7 @@ static void state_machine_v5( socks_hash_entry_t *hash_info, const u_char *pd, hash_info->state = Connecting; /* change state */ hash_info->connect_row = get_packet_ptr; - if (( offset+ 1) > fd->cap_len){ + if (( offset+ 1) > pi.captured_len){ hash_info->state = Done; /* change state */ return; } @@ -775,7 +775,7 @@ static void state_machine_v5( socks_hash_entry_t *hash_info, const u_char *pd, guint temp; - if (( offset+ 1) > fd->cap_len){ + if (( offset+ 1) > pi.captured_len){ hash_info->state = Done; /* change state */ return; } @@ -793,7 +793,7 @@ static void state_machine_v5( socks_hash_entry_t *hash_info, const u_char *pd, offset = get_address_v5( pd, offset, hash_info); - if (( offset+ 1) > fd->cap_len){ + if (( offset+ 1) > pi.captured_len){ hash_info->state = Done; return; } @@ -827,7 +827,7 @@ static void state_machine_v5( socks_hash_entry_t *hash_info, const u_char *pd, offset = get_address_v5( pd, offset, hash_info); /* save server udp port and create upd conversation */ - if (( offset+ 2) > fd->cap_len){ + if (( offset+ 2) > pi.captured_len){ hash_info->state = Done; return; } |