diff options
author | guy <guy@f5534014-38df-0310-8fa8-9805f1628bb7> | 2002-06-07 11:37:05 +0000 |
---|---|---|
committer | guy <guy@f5534014-38df-0310-8fa8-9805f1628bb7> | 2002-06-07 11:37:05 +0000 |
commit | fa7255309a97dffc46aad95ca49f80c8820d732a (patch) | |
tree | 731ba9d03afa186f5f7fc061c6d6758ebcbfd6cd | |
parent | 3b2e64d32aed7c7b0057b9f1fb0173a27e6e3171 (diff) |
Don't call "tvb_strsize(tvb, offset)" if we know there's nothing *at*
"offset".
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@5650 f5534014-38df-0310-8fa8-9805f1628bb7
-rw-r--r-- | packet-socks.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/packet-socks.c b/packet-socks.c index a12f229b31..2ec57fd5ed 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.39 2002/06/07 11:27:54 guy Exp $ + * $Id: packet-socks.c,v 1.40 2002/06/07 11:37:05 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -691,12 +691,22 @@ state_machine_v4( socks_hash_entry_t *hash_info, tvbuff_t *tvb, offset += 8; - if ( !tvb_offset_exists(tvb, offset)) /* if no user name */ + if ( !tvb_offset_exists(tvb, offset)) { /* if no user name */ /* change state */ hash_info->state = V4UserNameWait; - - - hash_info->connect_offset += tvb_strsize(tvb, offset) + 1; + /* + * XXX - add 1, or leave it alone? + * We were adding "strlen(...) + 1". + */ + hash_info->connect_offset += 1; + } else { + /* + * Add in the length of the user name. + * XXX - what if the user name is split between + * TCP segments? + */ + hash_info->connect_offset += tvb_strsize(tvb, offset); + } if ( !hash_info->dst_addr){ /* if no dest address */ /* if more data */ @@ -1180,4 +1190,3 @@ proto_reg_handoff_socks(void) { dissector_add("tcp.port", TCP_PORT_SOCKS, socks_handle); } - |