summaryrefslogtreecommitdiff
path: root/buckets
diff options
context:
space:
mode:
authorMladen Turk <mturk@apache.org>2021-12-01 13:23:15 +0000
committerMladen Turk <mturk@apache.org>2021-12-01 13:23:15 +0000
commitc36cdd01ce8b73880acaf320bdb959d206bfe867 (patch)
treebeccd137a97b251537603764588e67aaf51a03e0 /buckets
parentf56a1322d8dbc6a830ae5249d6cc2820fe87c541 (diff)
downloadapr-c36cdd01ce8b73880acaf320bdb959d206bfe867.tar.gz
Fix pointer arithmetic for 'void *'
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1895464 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'buckets')
-rw-r--r--buckets/apr_brigade.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/buckets/apr_brigade.c b/buckets/apr_brigade.c
index cf40eebac..aed10035d 100644
--- a/buckets/apr_brigade.c
+++ b/buckets/apr_brigade.c
@@ -389,19 +389,18 @@ APR_DECLARE(apr_status_t) apr_brigade_split_line(apr_bucket_brigade *bbOut,
#if !APR_HAVE_MEMMEM
static const void *
-memmem(const void *hay, size_t hay_len, const void *needle, size_t needle_len)
+memmem(const void *_hay, size_t hay_len, const void *needle, size_t needle_len)
{
-
if (hay_len < needle_len || !needle_len || !hay_len) {
return NULL;
}
else {
-
apr_size_t len = hay_len - needle_len + 1;
- const void *end = hay + hay_len;
+ const apr_byte_t *hay = (apr_byte_t *)_hay;
+ const apr_byte_t *end = hay + hay_len;
while ((hay = memchr(hay, *(char *)needle, len))) {
- len = end - hay - needle_len + 1;
+ len = (apr_size_t)(end - hay) - needle_len + 1;
if (memcmp(hay, needle, needle_len) == 0 ) {
break;