added memstr and extract_token_str helper functions
This commit is contained in:
@@ -76,6 +76,23 @@ void memxor(u_int8_t dest[], u_int8_t src[], size_t n)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Described in header.
|
||||
*/
|
||||
void *memstr(const void *haystack, const char *needle, size_t n)
|
||||
{
|
||||
unsigned const char *pos = haystack;
|
||||
size_t l = strlen(needle);
|
||||
for (; n >= l; ++pos, --n)
|
||||
{
|
||||
if (memeq(pos, needle, l))
|
||||
{
|
||||
return (void*)pos;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Described in header.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user