summaryrefslogtreecommitdiff
path: root/xs.h
diff options
context:
space:
mode:
authordefault <nobody@localhost>2022-12-11 10:33:01 +0100
committerdefault <nobody@localhost>2022-12-11 10:33:01 +0100
commitaa82e14bc7e7a3770feb23446d1a843d97213ccf (patch)
treeb4c0758aae4b5fa9a8b0c6282f7e45b2ab57eb9a /xs.h
parent0337c71cf45e9b646c1cd4cb39426073623267f2 (diff)
Backport from xs.
Diffstat (limited to 'xs.h')
-rw-r--r--xs.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/xs.h b/xs.h
index 3758c8d..b1e2cec 100644
--- a/xs.h
+++ b/xs.h
@@ -914,7 +914,8 @@ void *xs_memmem(const char *haystack, int h_size, const char *needle, int n_size
char *p, *r = NULL;
int offset = 0;
- while (!r && h_size - offset > n_size && (p = strchr(haystack + offset, *needle))) {
+ while (!r && h_size - offset > n_size &&
+ (p = memchr(haystack + offset, *needle, h_size - offset))) {
if (memcmp(p, needle, n_size) == 0)
r = p;
else