Ethereal-dev: Re: [Ethereal-dev] Help please - CVS ethereal blows up everytime

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Mark Burton <markb@xxxxxxxxxx>
Date: Fri, 05 Apr 2002 00:07:56 +0100
From: Guy Harris <gharris@xxxxxxxxx>
Subject: Re: [Ethereal-dev] Help please - CVS ethereal blows up everytime
Date: Thu, 4 Apr 2002 02:15:49 -0800

> If it does, fix that dissector not to use the return value of an
> "proto_tree_add_" routine as a "proto_tree *"; yes, "proto_tree" and
> "proto_item" happen to be typedeffed to the same value, but that doesn't
> mean they're the same sort of item - dissectors should assign an ett_
> value to all subtrees, and use "proto_item_add_subtree()" to convert a
> "proto_item *" to a "proto_tree *".

Ok, I have fixed packet-iscsi.c as you suggested and it has stopped
blowing up (diff attached).

This must be a new compatibility issue as the iSCSI dissector has not
changed in this respect. It seems to be affecting other dissectors as
well. For example, if I just capture some stuff off the local ethernet
it crashes and gdb says:

#4  0x081f37cf in alloc_field_info (tree=0x84abe5c, hfindex=139100576, 
    tvb=0x81f1d7c, start=139100576, length=0x846f0a4) at proto.c:1624
#5  0x081f2519 in proto_tree_add_none_format (tree=0x84abe5c, hfindex=6080, 
    tvb=0x846f0a4, start=8, length=4, format=0x1 <Address 0x1 out of bounds>)
    at proto.c:688
#6  0x08188451 in windowAttributes (tvb=0x846f0a4) at packet-x11.c:1447
#7  0x08188880 in dissect_x11_request_loop (tvb=0x846f0a4, root=0x84ac104)
    at packet-x11.c:1548
#8  0x0818c77f in dissect_x11 (tvb=0x846f0a4, pinfo=0x847bce0, tree=0x84abbc8)
    at packet-x11.c:2894

I guess we can expect lots of breakage until everyone fixes up their
dissectors.

Mark


Index: packet-iscsi.c
===================================================================
RCS file: /cvsroot/ethereal/packet-iscsi.c,v
retrieving revision 1.28
diff -u -3 -p -r1.28 packet-iscsi.c
--- packet-iscsi.c	2002/04/04 10:20:24	1.28
+++ packet-iscsi.c	2002/04/04 23:04:48
@@ -181,6 +181,7 @@ static int hf_iscsi_BegRun = -1;
 static int hf_iscsi_RunLength = -1;
 
 /* Initialize the subtree pointers */
+static gint ett_iscsi = -1;
 static gint ett_iscsi_KeyValues = -1;
 static gint ett_iscsi_CDB = -1;
 static gint ett_iscsi_Flags = -1;
@@ -719,7 +720,7 @@ static void
 dissect_iscsi_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset, guint8 opcode, const char *opcode_str, guint32 data_segment_len) {
 
     guint original_offset = offset;
-    proto_item *ti = NULL;
+    proto_tree *ti = NULL;
     char *scsi_command_name = NULL;
     guint8 scsi_status = 0;
     guint cdb_offset = offset + 32; /* offset of CDB from start of PDU */
@@ -861,11 +862,12 @@ dissect_iscsi_pdu(tvbuff_t *tvb, packet_
     /* In the interest of speed, if "tree" is NULL, don't do any
        work not necessary to generate protocol tree items. */
     if (tree) {
-
+	proto_item *tp;
 	/* create display subtree for the protocol */
-	ti = proto_tree_add_protocol_format(tree, proto_iscsi, tvb,
+	tp = proto_tree_add_protocol_format(tree, proto_iscsi, tvb,
 					    offset, -1, "iSCSI (%s)",
 					    (char *)opcode_str);
+	ti = proto_item_add_subtree(tp, ett_iscsi);
 
 	proto_tree_add_uint(ti, hf_iscsi_Opcode, tvb,
 			    offset + 0, 1, opcode);
@@ -2040,6 +2042,7 @@ proto_register_iscsi(void)
 
     /* Setup protocol subtree array */
     static gint *ett[] = {
+	&ett_iscsi,
 	&ett_iscsi_KeyValues,
 	&ett_iscsi_CDB,
 	&ett_iscsi_Flags,
This message has been 'sanitized'.  This means that potentially
dangerous content has been rewritten or removed.  The following
log describes which actions were taken.

Sanitizer (start="1017961684"):
  Replaced MIME boundary: >>--Next_Part--<<
                    with: >>MIMEStream=_0+254952_23195930223765_936149043<<
  Writer (pos="1559"):
    Total modifications so far: 1

  Part (pos="1605"):
    SanitizeFile (filename="unnamed.txt", mimetype="Text/Plain"):
      Match (rule="2"):
        Enforced policy: accept

  Part (pos="3291"):
    SanitizeFile (filename="foo.diff", mimetype="Text/Plain"):
      Match (rule="default"):
        Enforced policy: accept


Anomy 0.0.0 : Sanitizer.pm
$Id: Sanitizer.pm,v 1.32 2001/10/11 19:27:15 bre Exp $