Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Change in glibc's strncmp -> segfault?


I man page for strcmp on my Linux system, and it doesn't say anything
about the behavior of strcmp or stsrncmp when null pointers are passed. 
But sometimes you call add_match_part explicitly with NULL parameters for
the first six params.  Two of these are immediately passed into a strncmp

I upgraded my glibc on my Gentoo box in the last day or two to 2.3.2-r9. 
Unfortunately, I don't know what version I had before.  From around that
time, I started getting crashes when I would tab-complete a directory
name.  I made it whole again by changing line 344 in compmatch.c
(downloaded v. 4.1.1 today) from

    if (!strncmp(l, w, wl))

    if (l && !strncmp(l, w, wl))

I suppose it should really be (l && w && !strncmp(...)), on the chance
that there is somewhere that you are calling add_match_part with a null w
but a non-null l, but this fixed my immediate problem.  I have no idea if
this solution is "correct", but I hope at least I have pointed out the
right problem.

Bob Schmertz

Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes

Messages sorted by: Reverse Date, Date, Thread, Author