ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

Wireshark-dev: Re: [Wireshark-dev] Seg Fault - Creating new wiretap type

From: Stephen Fisher <steve@xxxxxxxxxxxxxxxxxx>
Date: Fri, 22 Oct 2010 11:34:47 -0600
On Thu, Oct 21, 2010 at 02:42:34PM -0700, Alex Lindberg wrote:

> That was my thought, however I used a debugger and printf statements 
> to watch the file handle passed to the wiretap routines. �The file was 
> the same in all cases. �This has me stumped. It seems that my string 
> buffer is not allowed during the file_gets routing. �Perhaps making 
> the buffer a const for the procedure, but that is not necessary in 
> other modules.

It is strange.  file_gets() is typically #define as gzgets() when 
compiled with zlib.  The return of gzgets() is the same as fgets() 
(which is used when zlib isn't present) - a char *.  I noticed that 
you're using an unsigned char (guchar), but a test program I made 
outside of Wireshark works fine with that too.  Want to send a patch of 
your changes so we can try it also?