Ethereal-dev: [Ethereal-dev] Ethereal crashes while thereal works for my decoder

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

From: "Luna Chen" <lunachen@xxxxxxxxxxxxxxxxxx>
Date: Fri, 19 Jan 2001 15:24:51 -0500
Hi,

I just started finding my way to write decoders, what I don't understand is, when I finish load my amf data, the GUI window crashes. If I use thereal -r, it works fine. Attached my core dump, and Here's my dissector:

dissect_amf(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
{
  struct amf_hdr *dp;
  int len;
  char to_slot[255];
  char from_slot[255];
  char to_msa[255];
  char to_mae[255];
  char from_msa[255];
  char from_mae[255];
  char priority[255];
  char length[255];

  dp = (struct amf_hdr *)&pd[offset];
  len = sizeof(*dp);

  OLD_CHECK_DISPLAY_AS_DATA(proto_amf, pd, offset, fd, tree);

  sprintf( from_slot, "<= Slot=%x", dp->from_slot);
  sprintf( to_slot,   "Slot=%x",    dp->to_slot);
  sprintf( from_msa,  "Msa=%x",     dp->from_msa);
  sprintf( to_msa,    "Msa=%x",     dp->to_msa);
  sprintf( from_mae,  "Mae=%x",     dp->from_mae);
  sprintf( to_mae,    "Mae=%x",     dp->to_mae);
  sprintf( priority,  "Pri=%x",     dp->priority);
  sprintf( length,    "Len=%x",     dp->length);

  if (check_col(fd, COL_PROTOCOL))
    col_set_str(fd, COL_PROTOCOL, "AMF");
  if (check_col(fd, COL_INFO));
    col_add_fstr(fd, COL_INFO, " %s %s %s %s %s %s %s %s", to_slot,to_msa,to_mae,
                                                           from_slot,from_msa,from_mae,priority,length);
}

void
proto_register_amf(void)
{

        static hf_register_info hf[] = {};

        static gint *ett[] = {
                &ett_amf,
        };

        proto_amf = proto_register_protocol ("AMF", "amf" );
        proto_register_field_array(proto_amf, hf, array_length(hf));
        proto_register_subtree_array(ett, array_length(ett));

        register_dissector("amf", dissect_amf);
}

void
proto_reg_handoff_amf(void)
{
  old_dissector_add("udp.port", UDP_PORT_AMF, dissect_amf);
}
 
 
 

-- Luna Chen