aboutsummaryrefslogtreecommitdiffstats
path: root/packet-socks.c
diff options
context:
space:
mode:
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2000-08-06 07:22:38 +0000
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2000-08-06 07:22:38 +0000
commita3dd49742a0ca5198d2c0650dedd37626b252d6c (patch)
tree15fd7095c9d57da2f1ec8b38841613236c1a1740 /packet-socks.c
parentb90978d08519624e351848eaae4dc750968deb93 (diff)
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. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@2214 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'packet-socks.c')
-rw-r--r--packet-socks.c18
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;
}