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] Crash after Init dissectors (read_hosts_file)

From: Shelly Cadora <scadora@xxxxxxxxx>
Date: Wed, 20 Sep 2006 14:14:26 -0700 (PDT)

Guy Harris <guy@xxxxxxxxxxxx> wrote:
Shelly Cadora wrote:
> Maybe I'm getting a little closer here...
>
> It looks like fgetline is failing when it tries to read from the hosts
> file. The file pointer returned by eth_fopen(hostspath, "r") in the
> read_hosts_file function is bad.

"Bad" in what sense?

If it's null, the open failed - but the current SVN version of
Wireshark, at least, checks for that, and just gives up.
Exactly!  Here's the bit from addr_resolve.c that fails:
 
if ((hf = eth_fopen(hostspath, "r")) == NULL)
   return FALSE;
while (fgetline(&line, &size, hf) >= 0) {
 
According to MSVC, the value of "hf" returned by eth_fopen is:
 
hf 0x77c5fce0 {_ptr=0x00000000 <Bad Ptr> _cnt=0 _base=0x00000000 <Bad Ptr> ...} _iobuf *
So "bad" in the "Bad Ptr" sense.  It's not "NULL" otherwise I would never have hit the fgetline.
 
Any thoughts appreciated.
 
Shelly



Do you Yahoo!?
Get on board. You're invited to try the new Yahoo! Mail.