This fixes calls like memmem("hello", 5, "lo", 2); Also zero-length needle is deemed to exist at beginning of haystack. This behavior matches memmem() on Linux, FreeBSD, NetBSD and OpenBSD. Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com>