From 45eaa7041813af53c062b8728b0e27d9907fd015 Mon Sep 17 00:00:00 2001 From: minfrin Date: Thu, 21 Oct 2021 11:21:54 +0000 Subject: apr_brigade_split_boundary: Use memmem and memcmp for comparison, allowing binary boundaries. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1894441 13f79535-47bb-0310-9956-ffa450edef68 --- buckets/apr_brigade.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'buckets') diff --git a/buckets/apr_brigade.c b/buckets/apr_brigade.c index e8ec4ca3b..584d64c2d 100644 --- a/buckets/apr_brigade.c +++ b/buckets/apr_brigade.c @@ -453,7 +453,7 @@ APR_DECLARE(apr_status_t) apr_brigade_split_boundary(apr_bucket_brigade *bbOut, apr_size_t off; apr_size_t leftover; - pos = strnstr(str + ignore, boundary, len - ignore); + pos = memmem(str + ignore, len - ignore, boundary, boundary_len); /* definitely found it, we leave */ if (pos != NULL) { @@ -482,7 +482,7 @@ APR_DECLARE(apr_status_t) apr_brigade_split_boundary(apr_bucket_brigade *bbOut, off = (len - leftover); while (leftover) { - if (!strncmp(str + off, boundary, leftover)) { + if (!memcmp(str + off, boundary, leftover)) { if (off) { @@ -525,7 +525,7 @@ APR_DECLARE(apr_status_t) apr_brigade_split_boundary(apr_bucket_brigade *bbOut, /* find all definite non matches */ while (len) { - if (!strncmp(str + off, boundary, len)) { + if (!memcmp(str + off, boundary, len)) { if (off) { @@ -587,7 +587,7 @@ skip: if (len > off) { /* not a match, bail out */ - if (strncmp(str, boundary + inbytes, off)) { + if (memcmp(str, boundary + inbytes, off)) { break; } @@ -610,7 +610,7 @@ skip: if (len == off) { /* not a match, bail out */ - if (strncmp(str, boundary + inbytes, off)) { + if (memcmp(str, boundary + inbytes, off)) { break; } @@ -631,7 +631,7 @@ skip: else if (len) { /* not a match, bail out */ - if (strncmp(str, boundary + inbytes, len)) { + if (memcmp(str, boundary + inbytes, len)) { break; } -- cgit v1.2.1