fix bug in cli_memchr

git-svn: trunk@758
remotes/push_mirror/metadata
Tomasz Kojm 21 years ago
parent 168dee2c8e
commit 91cad009be
  1. 9
      clamav-devel/libclamav/others.c

@ -493,14 +493,19 @@ int cli_memstr(const char *haystack, int hs, const char *needle, int ns)
n = hs;
while((pt = memchr(hay, needle[0], n)) != NULL) {
n = (int) pt - (int) hay;
n -= (int) pt - (int) hay;
if(n < ns)
break;
if(!memcmp(pt, needle, ns))
return 1;
hay = pt;
if(hay == pt) {
n--;
hay++;
} else {
hay = pt;
}
}
return 0;

Loading…
Cancel
Save