diff options
author | Nick Mathewson <nickm@torproject.org> | 2005-08-22 00:34:23 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2005-08-22 00:34:23 +0000 |
commit | 9321db8c2991a4e96f705b1e290d361021c0c229 (patch) | |
tree | 9399a1e8ff633dff492558e06b85c519ece1eb8d /src/common | |
parent | 7a442c2c48e2da1649f90aff78988236c7aab94f (diff) | |
download | tor-9321db8c2991a4e96f705b1e290d361021c0c229.tar.gz tor-9321db8c2991a4e96f705b1e290d361021c0c229.zip |
Fix bug with tor_memmem finding a match at the end of the string.
svn:r4803
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/compat.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/common/compat.c b/src/common/compat.c index abe6714716..b3c1b17235 100644 --- a/src/common/compat.c +++ b/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; |