summaryrefslogtreecommitdiff
path: root/packet-socks.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2001-01-10 10:59:11 +0000
committerGuy Harris <guy@alum.mit.edu>2001-01-10 10:59:11 +0000
commit4d3f77c65cdbe91e0a9946454d211ee3f4261552 (patch)
treefc5b91b8287644c950bdd41a0cf5247aad38d44f /packet-socks.c
parentbd1d96cd6f25acd31b017d38bf875d7e72e1911a (diff)
downloadwireshark-4d3f77c65cdbe91e0a9946454d211ee3f4261552.tar.gz
Change from Jeff Foster to keep the dissector from crashing if the
conversation it found has no data associated with it; this is a workaround for a problem that shows up if a conversation is between two ports both of which have protocols associated with them - in that case, frames going in one direction might be dissected by one of those dissectors, and frames going in the other direction might be dissected by the other dissector, causing untold confusion. We really need to associate dissectors with conversations as soon as the conversation is created, so that all packets will be handled by the same dissector. (The SOCKS dissector now does that.) svn path=/trunk/; revision=2862
Diffstat (limited to 'packet-socks.c')
-rw-r--r--packet-socks.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/packet-socks.c b/packet-socks.c
index 33816efe30..2bd573df4e 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.17 2001/01/09 06:31:43 guy Exp $
+ * $Id: packet-socks.c,v 1.18 2001/01/10 10:59:11 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -30,6 +30,10 @@
*
* See http://www.socks.nec.com/socksprot.html for these and other documents
*
+ * Revisions:
+ *
+ * 2001-01-08 JCFoster Fixed problem with NULL pointer for hash data.
+ * Now test and exit if hash_info is null.
*/
/* Possible enhancements -
@@ -963,11 +967,15 @@ dissect_socks(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
conversation = find_conversation( &pi.src, &pi.dst, pi.ptype,
pi.srcport, pi.destport, 0);
- if ( conversation) /* conversation found */
+ if ( conversation){ /* conversation found */
hash_info = conversation->data;
+ if ( !hash_info){ /* exit if bad value */
+ old_dissect_data(pd, offset, fd, tree);
+ return;
+ }
/* new conversation create local data structure */
- else {
+ } else {
hash_info = g_mem_chunk_alloc(socks_vals);
hash_info->start_done_row = G_MAXINT;
hash_info->state = None;
@@ -978,8 +986,11 @@ dissect_socks(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
( hash_info->version != 5))
hash_info->state = Done;
- conversation_new( &pi.src, &pi.dst, pi.ptype,
+ conversation = conversation_new( &pi.src, &pi.dst, pi.ptype,
pi.srcport, pi.destport, hash_info, 0);
+
+ /* set dissector for now */
+ old_conversation_set_dissector(conversation, dissect_socks);
}
/* display summary window information */