Paul Eggert wrote: > > - if (memmem (haystack, 3, NULL, 0) != haystack) > > + if (memmem (haystack, 3, (const char *) 1, 0) != haystack) > > This has undefined behavior in general, no?
No. memmem is not supposed to access more than NEEDLELEN bytes at NEEDLE. > How about using '""' instead of '(const char *) 1'? That would defeat the purpose of the test, which is to test for the glibc 2.0 bug [1]. Bruno [1] http://man7.org/linux/man-pages/man3/memmem.3.html