Wireshark-dev: Re: [Wireshark-dev] How to get UDP port numbers in sub-dissector
Date: Tue, 24 May 2011 21:06:18 +0200
On Tue, May 24, 2011 at 02:50:35PM -0400, eymanm wrote:
>     col_add_fstr(pinfo->cinfo, COL_INFO, "Source: %s", pinfo->srcport);
> 
> When I run, it puts "[Dissector bug, protocol XXX: STATUS_ACCESS_VIOLATION:
> dissector accessed and invalid memory address]" in the Info column.
> 
> What am I doing wrong?

pinfo->srcport is number so you MUST not use %s (which is for string)
Use %u instead, i.e:
>     col_add_fstr(pinfo->cinfo, COL_INFO, "Source: %u", pinfo->srcport);

You can read more about formating string on man 3 printf, html version:
http://linux.die.net/man/3/printf

Cheers.