Ethereal-dev: Re: [ethereal-dev] Ethereal segfault

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

From: Guy Harris <gharris@xxxxxxxxxxxx>
Date: Mon, 6 Mar 2000 11:40:38 -0800
> Ethereal 0.8.4 dumps core on the attached capture file. It's a small
> capture of a IPP request and answer on the lo interface.

I've attached a patch.

(The problem was a call to "proto_tree_add_text()" with an argument list
that didn't match the format; GCC didn't catch that because
"proto_tree_add_text()" wasn't, when compiled with GCC, declared with an
"__attribute__((format (printf, ...))" clause - doing that is tricky, as
"_proto_tree_add_item_value()"'s first "varargs" argument is *not* a
format string, so I'll have to look into seeing if that can be done,
i.e.  if the first argument number in said clause has to refer to a
declared argument. 

Tweaking the header to do such a declaration, in a fashion that might
not generate the right code, caught a whole *bunch* of invalid calls,
which I've been working on fixing.)

By the way, mail to you bounced with:

<han.holl@xxxxxxxxxxx>:
131.211.16.32 does not like recipient.
Remote host said: 550 <han.holl@xxxxxxxxxxx>: Recipient address rejected:
    Relay access denied
Giving up.

"131.211.16.32" is "mail2.sig.nl", which claims to be the preference-5
mail exchanger for "prismant.nl":

	% nslookup
	Default Server:  ns.above.net
	Address:  207.126.96.162

	> set type=any
	> server ns.accu.uu.nl
	Default Server:  ns.accu.uu.nl
	Address:  131.211.16.32

	> prismant.nl.
	Server:  ns.accu.uu.nl
	Address:  131.211.16.32

	prismant.nl     preference = 5, mail exchanger = mail2.sig.nl
	prismant.nl     preference = 10, mail exchanger = mail.accu.uu.nl

		...

so either your DNS records are wrong, or "mail2.sig.nl" is
misconfigured, as if it's going to be a mail exchanger, it has to
support mail relaying....
Index: packet-ipp.c
===================================================================
RCS file: /usr/local/cvsroot/ethereal/packet-ipp.c,v
retrieving revision 1.4
diff -c -r1.4 packet-ipp.c
*** packet-ipp.c	2000/01/22 06:22:13	1.4
--- packet-ipp.c	2000/03/06 19:24:40
***************
*** 144,162 ****
  static int parse_attributes(const u_char *pd, int offset, frame_data *fd,
      proto_tree *tree);
  static proto_tree *add_integer_tree(proto_tree *tree, const u_char *pd,
!     int offset, guint name_length, guint value_length);
  static void add_integer_value(guint tag, gchar *tag_desc, proto_tree *tree,
      const u_char *pd, int offset, guint name_length, guint value_length);
  static proto_tree *add_octetstring_tree(proto_tree *tree, const u_char *pd,
!     int offset, guint name_length, guint value_length);
  static void add_octetstring_value(guint tag, gchar *tag_desc, proto_tree *tree,
      const u_char *pd, int offset, guint name_length, guint value_length);
  static proto_tree *add_charstring_tree(proto_tree *tree, const u_char *pd,
!     int offset, guint name_length, guint value_length);
  static void add_charstring_value(guint tag, gchar *tag_desc, proto_tree *tree,
!     const u_char *pd, int offset, guint name_length, guint value_length);
  static int add_value_head(guint tag, gchar *tag_desc, proto_tree *tree,
!     const u_char *pd, int offset, guint name_length, guint value_length);
  
  void dissect_ipp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
  {
--- 144,162 ----
  static int parse_attributes(const u_char *pd, int offset, frame_data *fd,
      proto_tree *tree);
  static proto_tree *add_integer_tree(proto_tree *tree, const u_char *pd,
!     int offset, int name_length, guint value_length);
  static void add_integer_value(guint tag, gchar *tag_desc, proto_tree *tree,
      const u_char *pd, int offset, guint name_length, guint value_length);
  static proto_tree *add_octetstring_tree(proto_tree *tree, const u_char *pd,
!     int offset, int name_length, guint value_length);
  static void add_octetstring_value(guint tag, gchar *tag_desc, proto_tree *tree,
      const u_char *pd, int offset, guint name_length, guint value_length);
  static proto_tree *add_charstring_tree(proto_tree *tree, const u_char *pd,
!     int offset, int name_length, guint value_length);
  static void add_charstring_value(guint tag, gchar *tag_desc, proto_tree *tree,
!     const u_char *pd, int offset, int name_length, guint value_length);
  static int add_value_head(guint tag, gchar *tag_desc, proto_tree *tree,
!     const u_char *pd, int offset, int name_length, guint value_length);
  
  void dissect_ipp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
  {
***************
*** 453,459 ****
  
  static proto_tree *
  add_integer_tree(proto_tree *tree, const u_char *pd, int offset,
!     guint name_length, guint value_length)
  {
  	proto_item *ti;
  
--- 453,459 ----
  
  static proto_tree *
  add_integer_tree(proto_tree *tree, const u_char *pd, int offset,
!     int name_length, guint value_length)
  {
  	proto_item *ti;
  
***************
*** 487,493 ****
  
  static proto_tree *
  add_octetstring_tree(proto_tree *tree, const u_char *pd, int offset,
!     guint name_length, guint value_length)
  {
  	proto_item *ti;
  
--- 487,493 ----
  
  static proto_tree *
  add_octetstring_tree(proto_tree *tree, const u_char *pd, int offset,
!     int name_length, guint value_length)
  {
  	proto_item *ti;
  
***************
*** 495,502 ****
  	    1 + 2 + name_length + 2 + value_length,
  	    "%.*s: %s",
  	    name_length,
! 	    &pd[offset + 1 + 2]);
! 	    bytes_to_str(&pd[offset + 1 + 2 + name_length + 2], value_length);
  	return proto_item_add_subtree(ti, ett_ipp_attr);
  }
  
--- 495,502 ----
  	    1 + 2 + name_length + 2 + value_length,
  	    "%.*s: %s",
  	    name_length,
! 	    &pd[offset + 1 + 2],
! 	    bytes_to_str(&pd[offset + 1 + 2 + name_length + 2], value_length));
  	return proto_item_add_subtree(ti, ett_ipp_attr);
  }
  
***************
*** 512,518 ****
  
  static proto_tree *
  add_charstring_tree(proto_tree *tree, const u_char *pd, int offset,
!     guint name_length, guint value_length)
  {
  	proto_item *ti;
  
--- 512,518 ----
  
  static proto_tree *
  add_charstring_tree(proto_tree *tree, const u_char *pd, int offset,
!     int name_length, guint value_length)
  {
  	proto_item *ti;
  
***************
*** 526,532 ****
  
  static void
  add_charstring_value(guint tag, gchar *tag_desc, proto_tree *tree,
!     const u_char *pd, int offset, guint name_length, guint value_length)
  {
  	offset = add_value_head(tag, tag_desc, tree, pd, offset,
  	    name_length, value_length);
--- 526,532 ----
  
  static void
  add_charstring_value(guint tag, gchar *tag_desc, proto_tree *tree,
!     const u_char *pd, int offset, int name_length, guint value_length)
  {
  	offset = add_value_head(tag, tag_desc, tree, pd, offset,
  	    name_length, value_length);
***************
*** 536,542 ****
  
  static int
  add_value_head(guint tag, gchar *tag_desc, proto_tree *tree,
!     const u_char *pd, int offset, guint name_length, guint value_length)
  {
  	proto_tree_add_text(tree, offset, 1, "Tag: %s", tag_desc);
  	offset += 1;
--- 536,542 ----
  
  static int
  add_value_head(guint tag, gchar *tag_desc, proto_tree *tree,
!     const u_char *pd, int offset, int name_length, guint value_length)
  {
  	proto_tree_add_text(tree, offset, 1, "Tag: %s", tag_desc);
  	offset += 1;