[Lcdproc] CVS stable-0-4-3: Status

Ethan Dicks erd@iname.com
Mon May 13 19:27:03 2002


--- Rene Wagner <reenoo@gmx.de> wrote:
> > >But: clients/lcdproc/lcdproc C G T M X D B S O K U P A causes this:
> > >
> > >Program received signal SIGSEGV, Segmentation fault.
> > >0xff133084 in strlen () from /usr/lib/libc.so.1
> > >(gdb)
> > >
> > >We seem to have crashed libc ;)
> > 
> > So it looks like we only have problems remaining on Solaris and Debian PPC.
> 
> A backtrace shows this:
> 
> Program received signal SIGSEGV, Segmentation fault.
> 0xff133084 in strlen () from /usr/lib/libc.so.1
> (gdb) bt
> #0  0xff133084 in strlen () from /usr/lib/libc.so.1
> #1  0xff182bd0 in _doprnt () from /usr/lib/libc.so.1
> #2  0xff184914 in snprintf () from /usr/lib/libc.so.1
> #3  0x1783c in do_mainloop () at main.c:911
> #4  0x16200 in main (argc=0, argv=0xffbefcec) at main.c:256
> (gdb) 
> 
> main.c:911 is:
> 
> snprintf(message, 256, "Screen->%s has timeout->%d", s->name, s->timeout);
> 
> Nothing unusual, is it?

As I said in an earlier message, the behavior of strlen() is undefined when
you pass it a NULL pointer (according to the ANSI spec).  Under Solaris, it
typically segfaults.  This is "acceptable behavior" when you ask the lib
to do something undefined.  I did a quick analysis of the pointers
going into that snprintf, and I think I pointed out which one was null (the
others were all tested first, immediately prior to this line).  A simple
one or two-line fix should eliminate the problem.

-ethan


=====
Visit "The Seventh Continent"
http://penguincentral.com/penguincentral.html

__________________________________________________
Do You Yahoo!?
LAUNCH - Your Yahoo! Music Experience
http://launch.yahoo.com