From f965980e2b309921e0b869c05177f1ee3937a845 Mon Sep 17 00:00:00 2001 From: Pali Rohár Date: Thu, 15 Jan 2015 09:42:01 +0100 Subject: all: Fix MEMMEM implementation --- src/global.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/global.h') diff --git a/src/global.h b/src/global.h index 4cff79f..a26c88b 100644 --- a/src/global.h +++ b/src/global.h @@ -27,7 +27,7 @@ extern int verbose; static inline void * MEMMEM(void *haystack, size_t haystacklen, const void *needle, size_t needlelen) { for ( size_t i = 0; i < haystacklen; ++i ) { for ( size_t j = 0; j < needlelen; ++j ) { - if ( ((char *)haystack)[i] != ((const char *)needle)[j] ) + if ( ((char *)haystack)[i+j] != ((const char *)needle)[j] ) break; if ( j != needlelen - 1 ) continue; -- cgit v1.2.3