On 11/08/2010 07:31 AM, Дилян Палаузов wrote:
> Hello,
>
> When I use the latest strstr implemenation from gnulib in git, the
> following program crashes (causes Segmentation fault):
>
> #include <string.h>
> #include <stdio.h>
>
> void main() {
> char *find = strstr ("**AB** **CD** **AB** **CD** **CD**", "**CD**");
> printf("%s\n", find);
> }Can you provide a backtrace of the crash? I can't reproduce it. In order to use the implementation from gnulib, you should probably be including <config.h>. > > It does not crash when I use strstr from libc-2.9 . glibc 2.9 through 2.12 have the same bug as gnulib's strstr used to have. You have to use something newer than 2.12 (these days, most distros have backported the glibc.git patch back to their shipped glibc version), to avoid that bug. But that bug was unrelated to a segfault, so I still can't figure out why your example would be crashing. -- Eric Blake [email protected] +1-801-349-2682 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
