You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by mi...@apache.org on 2021/10/21 11:22:27 UTC

svn commit: r1894442 - /apr/apr-util/branches/1.7.x/buckets/apr_brigade.c

Author: minfrin
Date: Thu Oct 21 11:22:27 2021
New Revision: 1894442

URL: http://svn.apache.org/viewvc?rev=1894442&view=rev
Log:
Backport:
apr_brigade_split_boundary: Use memmem and memcmp for comparison, allowing
binary boundaries.

Modified:
    apr/apr-util/branches/1.7.x/buckets/apr_brigade.c

Modified: apr/apr-util/branches/1.7.x/buckets/apr_brigade.c
URL: http://svn.apache.org/viewvc/apr/apr-util/branches/1.7.x/buckets/apr_brigade.c?rev=1894442&r1=1894441&r2=1894442&view=diff
==============================================================================
--- apr/apr-util/branches/1.7.x/buckets/apr_brigade.c (original)
+++ apr/apr-util/branches/1.7.x/buckets/apr_brigade.c Thu Oct 21 11:22:27 2021
@@ -420,7 +420,7 @@ APU_DECLARE(apr_status_t) apr_brigade_sp
             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) {
@@ -449,7 +449,7 @@ APU_DECLARE(apr_status_t) apr_brigade_sp
             off = (len - leftover);
 
             while (leftover) {
-                if (!strncmp(str + off, boundary, leftover)) {
+                if (!memcmp(str + off, boundary, leftover)) {
 
                     if (off) {
 
@@ -492,7 +492,7 @@ APU_DECLARE(apr_status_t) apr_brigade_sp
 
             /* find all definite non matches */
             while (len) {
-                if (!strncmp(str + off, boundary, len)) {
+                if (!memcmp(str + off, boundary, len)) {
 
                     if (off) {
 
@@ -554,7 +554,7 @@ skip:
             if (len > off) {
 
                 /* not a match, bail out */
-                if (strncmp(str, boundary + inbytes, off)) {
+                if (memcmp(str, boundary + inbytes, off)) {
                     break;
                 }
 
@@ -577,7 +577,7 @@ skip:
             if (len == off) {
 
                 /* not a match, bail out */
-                if (strncmp(str, boundary + inbytes, off)) {
+                if (memcmp(str, boundary + inbytes, off)) {
                     break;
                 }
 
@@ -598,7 +598,7 @@ skip:
             else if (len) {
 
                 /* not a match, bail out */
-                if (strncmp(str, boundary + inbytes, len)) {
+                if (memcmp(str, boundary + inbytes, len)) {
                     break;
                 }