mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-28 14:23:30 +01:00
Fix bug with tor_memmem finding a match at the end of the string.
svn:r4803
This commit is contained in:
parent
7a442c2c48
commit
9321db8c29
@ -161,7 +161,7 @@ tor_memmem(const void *_haystack, size_t hlen, const void *_needle, size_t nlen)
|
|||||||
end = haystack + hlen;
|
end = haystack + hlen;
|
||||||
first = *(const char*)needle;
|
first = *(const char*)needle;
|
||||||
while ((p = memchr(p, first, end-p))) {
|
while ((p = memchr(p, first, end-p))) {
|
||||||
if (p+nlen >= end)
|
if (p+nlen > end)
|
||||||
return NULL;
|
return NULL;
|
||||||
if (!memcmp(p, needle, nlen))
|
if (!memcmp(p, needle, nlen))
|
||||||
return p;
|
return p;
|
||||||
|
Loading…
Reference in New Issue
Block a user