Browse Source

Fix bug with tor_memmem finding a match at the end of the string.

svn:r4803
Nick Mathewson 20 years ago
parent
commit
9321db8c29
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/common/compat.c

+ 1 - 1
src/common/compat.c

@@ -161,7 +161,7 @@ tor_memmem(const void *_haystack, size_t hlen, const void *_needle, size_t nlen)
   end = haystack + hlen;
   first = *(const char*)needle;
   while ((p = memchr(p, first, end-p))) {
-    if (p+nlen >= end)
+    if (p+nlen > end)
       return NULL;
     if (!memcmp(p, needle, nlen))
       return p;