]> granicus.if.org Git - apache/commitdiff
Correctly handle the case where apr_brigade_partition() returns APR_INCOMPLETE
authorStefan Fritsch <sf@apache.org>
Wed, 17 Mar 2010 19:59:56 +0000 (19:59 +0000)
committerStefan Fritsch <sf@apache.org>
Wed, 17 Mar 2010 19:59:56 +0000 (19:59 +0000)
and b points to the sentinel of ctx->proc_bb and not the sentinel of bb.
(Similar fix as r910326)

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@924452 13f79535-47bb-0310-9956-ffa450edef68

modules/filters/mod_sed.c

index f9c69b7eb90bbe4fe19efd929f9867deb90fac27..84d5b7c302ff421cf68103eb6c30e12ced4212fb 100644 (file)
@@ -478,11 +478,13 @@ static apr_status_t sed_request_filter(ap_filter_t *f,
     if (!APR_BRIGADE_EMPTY(ctx->bb)) {
         apr_bucket *b = NULL;
 
-        /* This may return APR_INCOMPLETE which should be fine */
-        apr_brigade_partition(ctx->bb, readbytes, &b);
-
-        APR_BRIGADE_CONCAT(bb, ctx->bb);
-        apr_brigade_split_ex(bb, b, ctx->bb);
+        if (apr_brigade_partition(ctx->bb, readbytes, &b) == APR_INCOMPLETE) {
+            APR_BRIGADE_CONCAT(bb, ctx->bb);
+        }
+        else {
+            APR_BRIGADE_CONCAT(bb, ctx->bb);
+            apr_brigade_split_ex(bb, b, ctx->bb);
+        }
     }
     return APR_SUCCESS;
 }