mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-27 13:53:31 +01:00
add sanity check in tor_memmem
it's believed most libc already have those, but just in case, it can't hurt
This commit is contained in:
parent
cec6f9919d
commit
f2ddfdd50e
@ -31,6 +31,8 @@ tor_memmem(const void *_haystack, size_t hlen,
|
||||
{
|
||||
#if defined(HAVE_MEMMEM) && (!defined(__GNUC__) || __GNUC__ >= 2)
|
||||
raw_assert(nlen);
|
||||
if (nlen > hlen)
|
||||
return NULL;
|
||||
return memmem(_haystack, hlen, _needle, nlen);
|
||||
#else
|
||||
/* This isn't as fast as the GLIBC implementation, but it doesn't need to
|
||||
|
Loading…
Reference in New Issue
Block a user