summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPali Rohár <pali.rohar@gmail.com>2015-01-15 09:42:01 +0100
committerPali Rohár <pali.rohar@gmail.com>2015-01-15 09:42:01 +0100
commitf965980e2b309921e0b869c05177f1ee3937a845 (patch)
treed0e23e859eec9f3f901b860f42fbd4ce29969f65
parentef678ecf6c72c3df72b28685f83186228c5afd9b (diff)
download0xFFFF-f965980e2b309921e0b869c05177f1ee3937a845.tar.bz2
all: Fix MEMMEM implementation
-rw-r--r--src/global.h2
1 files changed, 1 insertions, 1 deletions
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;