Fixed issue #33

merge-requests/3/head
bzt 2 years ago
parent f9249ab0b6
commit 1ebaf59a90

@ -95,7 +95,7 @@ void *memmem(const void *haystack, size_t hl, const void *needle, size_t nl)
{ {
uint8_t *c = (uint8_t*)haystack; uint8_t *c = (uint8_t*)haystack;
if(!haystack || !needle || !hl || !nl || nl > hl) return NULL; if(!haystack || !needle || !hl || !nl || nl > hl) return NULL;
hl -= nl; hl -= nl - 1;
while(hl) { while(hl) {
if(!memcmp(c, needle, nl)) return c; if(!memcmp(c, needle, nl)) return c;
c++; hl--; c++; hl--;

Loading…
Cancel
Save