[klibc] memmem broken?

Kay Sievers kay.sievers at vrfy.org
Wed Feb 16 06:15:01 PST 2005


We have a bad bug in udev if compiled with klibc. I seems that the needle
string can't have a strlen of 1. This test case illustrates it:

#include <stdio.h>
#include <string.h>

int main(int argc, char *argv[], char *envp[])
{
	char *hay = "a/b";
	char *needle = "/";

	if (memmem(hay, strlen(hay), needle, strlen(needle)) == NULL)
		printf("This uses the 'Not So Naive' algorithm... Which is broken. :)\n");
	else
		printf("ok\n");
}

Thanks,
Kay



More information about the klibc mailing list