Ethereal-dev: Re: [Ethereal-dev] Ethereal crashes while thereal works for my decoder
On Fri, Jan 19, 2001 at 03:25:51PM -0500, Luna Chen wrote:
> 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];
You can't do that on a RISC box. The address may not
be on the proper boundary.
Write a tvbuff-based dissector instead of the old-style
dissectors (see doc/README.tvbuff). The tvbuff accessor
methods let you grab data out of the tvbuff.
Also, a core file doesn't help anyone on the list, since
it reflects the ethereal executable as compiled on your machine.
The backtrace however (produced using your debugger and the
core file) is helpful.
--gilbert