diff options
Diffstat (limited to 'buckets/apr_brigade.c')
-rw-r--r-- | buckets/apr_brigade.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/buckets/apr_brigade.c b/buckets/apr_brigade.c index ffe79765b..e8ec4ca3b 100644 --- a/buckets/apr_brigade.c +++ b/buckets/apr_brigade.c @@ -395,6 +395,7 @@ APR_DECLARE(apr_status_t) apr_brigade_split_boundary(apr_bucket_brigade *bbOut, apr_off_t maxbytes) { apr_off_t outbytes = 0; + apr_off_t ignore = 0; if (!boundary || !boundary[0]) { return APR_EINVAL; @@ -447,12 +448,12 @@ APR_DECLARE(apr_status_t) apr_brigade_split_boundary(apr_bucket_brigade *bbOut, * If we have at least one boundary worth of data, do an optimised * substring search for the boundary, and split quickly if found. */ - if (len >= boundary_len) { + if ((len - ignore) >= boundary_len) { apr_size_t off; apr_size_t leftover; - pos = strnstr(str, boundary, len); + pos = strnstr(str + ignore, boundary, len - ignore); /* definitely found it, we leave */ if (pos != NULL) { @@ -518,7 +519,9 @@ APR_DECLARE(apr_status_t) apr_brigade_split_boundary(apr_bucket_brigade *bbOut, */ else { - apr_size_t off = 0; + apr_size_t off = ignore; + + len -= ignore; /* find all definite non matches */ while (len) { @@ -644,11 +647,7 @@ skip: * * Bump one byte off, and loop round to search again. */ - apr_bucket_split(e, 1); - APR_BUCKET_REMOVE(e); - APR_BRIGADE_INSERT_TAIL(bbOut, e); - - outbytes++; + ignore++; } |