diff options
-rw-r--r-- | src/string/memmem.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/string/memmem.c b/src/string/memmem.c index d7e12219..4be6a310 100644 --- a/src/string/memmem.c +++ b/src/string/memmem.c @@ -140,6 +140,7 @@ void *memmem(const void *h0, size_t k, const void *n0, size_t l) h = memchr(h0, *n, k); if (!h || l==1) return (void *)h; k -= h - (const unsigned char *)h0; + if (k<l) return 0; if (l==2) return twobyte_memmem(h, k, n); if (l==3) return threebyte_memmem(h, k, n); if (l==4) return fourbyte_memmem(h, k, n); |