Ethereal-dev: Re: [ethereal-dev] WIN32 interface list and packet capture patch

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

From: Guy Harris <guy@xxxxxxxxxx>
Date: Tue, 21 Mar 2000 17:47:13 -0800 (PST)
> > The bug itself has to do with the MSVC++ 6 version of strlen being 
> > unable to handle empty string. I know this sounds unlikely, but if 
> > I supply a NULL pointer to it, it generates an access violation in 
> > debug mode and when I just run the same executable outside the 
> > debugger it hangs.
> 
> ...whereas on many UNIX systems (probably most of them, at this point)
> it just generates a segmentation violation, period, regardless of
> whether you're running it inside a debugger or not.

Sure does.  If I read, on Solaris 2.5.1/SPARC with an Ethereal lacking
your change, the capture you sent me, it blows up in:

(gdb) where
#0  0xef2a3ec0 in strlen () from /usr/lib/libc.so.1
#1  0xa265c in strings (p=0xefffdb70, tmp=0x0) at snprintf.c:328
#2  0xa3804 in vsnprintf (string=0x1 <Address 0x1 out of bounds>, 
    length=4026522480, format=0x114590 "%s %s", args=0xefffdc84)
    at snprintf.c:603
#3  0x9541c in col_add_fstr (fd=0x278478, el=30, format=0x114590 "%s %s")
    at packet.c:694
#4  0x789f4 in dissect_transact_smb (pd=0x275e10 "\002?\202\213-g", offset=90, 
    fd=0x278478, parent=0x25a774, tree=0x25abac, si={tid = 2051, uid = 2051, 
      mid = 35904, pid = 49792, conversation = 0x27c578, 
      request_val = 0x27d588, unicode = 1}, max_data=1456, SMB_offset=58, 
    errcode=0, dirn=0) at packet-smb.c:9326

	...

and your change fixes the problem.  It'll probably blow up on a number
of other platforms as well.