diff options
author | default <nobody@localhost> | 2022-12-11 10:33:01 +0100 |
---|---|---|
committer | default <nobody@localhost> | 2022-12-11 10:33:01 +0100 |
commit | aa82e14bc7e7a3770feb23446d1a843d97213ccf (patch) | |
tree | b4c0758aae4b5fa9a8b0c6282f7e45b2ab57eb9a | |
parent | 0337c71cf45e9b646c1cd4cb39426073623267f2 (diff) |
Backport from xs.
-rw-r--r-- | xs.h | 3 | ||||
-rw-r--r-- | xs_httpd.h | 4 | ||||
-rw-r--r-- | xs_version.h | 2 |
3 files changed, 5 insertions, 4 deletions
@@ -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 @@ -131,13 +131,13 @@ d_char *_xs_multipart_form_data(char *payload, int p_size, char *header) } /* find the start of the part content */ - if ((p = xs_memmem(p, p_size - offset, "\r\n\r\n", 4)) == NULL) + if ((p = xs_memmem(p, p_size - (p - payload), "\r\n\r\n", 4)) == NULL) break; p += 4; /* find the next boundary */ - if ((q = xs_memmem(p, p_size - offset, boundary, bsz)) == NULL) + if ((q = xs_memmem(p, p_size - (p - payload), boundary, bsz)) == NULL) break; po = p - payload; diff --git a/xs_version.h b/xs_version.h index 5b9a4cf..802072a 100644 --- a/xs_version.h +++ b/xs_version.h @@ -1 +1 @@ -/* 3aa82bc4fc310ec95194602bed88a9767e100350 */ +/* d5a6108812a499a389030a1402ce49f282b4a818 */ |