]> granicus.if.org Git - apache/commitdiff
Merge r1311174 from trunk:
authorJim Jagielski <jim@apache.org>
Fri, 27 Apr 2012 13:07:45 +0000 (13:07 +0000)
committerJim Jagielski <jim@apache.org>
Fri, 27 Apr 2012 13:07:45 +0000 (13:07 +0000)
Fix error handling in ap_scan_script_header_err_brigade() if there
is no EOS bucket in the brigade:

Also don't loop if there is a timeout when discarding the script output.

Thanks to Edgar Frank for the analysis.

PR: 48272 (partial fix)

Submitted by: sf
Reviewed/backported by: jim

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1331414 13f79535-47bb-0310-9956-ffa450edef68

STATUS
server/util_script.c

diff --git a/STATUS b/STATUS
index 3ccfcf5f6e6ab2e8a7b0addc74e8b33ab8d149a9..42ac0b10690f6e874e177aa54963362e57f1b699 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -95,14 +95,6 @@ PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
     2.4 patch: Trunk patch works
     +1: sf, jorton, jim
 
-  * core: Fix error handling in ap_scan_script_header_err_brigade() if there
-    is no EOS bucket in the brigade.
-    Also don't loop if there is a timeout when discarding the script output.
-    PR: 48272 (partial fix)
-    Trunk patch: http://svn.apache.org/viewvc?view=revision&revision=1311174
-    2.4 patch: Trunk patch works
-    +1: sf, jorton, jim
-
 
 PATCHES PROPOSED TO BACKPORT FROM TRUNK:
   [ New proposals should be added at the end of the list ]
index 18c4aea4ca46329f7bd627a61f3ed8f466d5412e..f9f3e098039e78bc177769a6afdcc1223dda45f2 100644 (file)
@@ -553,7 +553,7 @@ AP_DECLARE(int) ap_scan_script_header_err_core_ex(request_rec *r, char *buffer,
         if (!(l = strchr(w, ':'))) {
             if (!buffer) {
                 /* Soak up all the script output - may save an outright kill */
-                while ((*getsfunc) (w, MAX_STRING_LEN - 1, getsfunc_data)) {
+                while ((*getsfunc)(w, MAX_STRING_LEN - 1, getsfunc_data) > 0) {
                     continue;
                 }
             }
@@ -672,7 +672,8 @@ static int getsfunc_BRIGADE(char *buf, int len, void *arg)
     apr_status_t rv;
     int done = 0;
 
-    while ((dst < dst_end) && !done && !APR_BUCKET_IS_EOS(e)) {
+    while ((dst < dst_end) && !done && e != APR_BRIGADE_SENTINEL(bb)
+           && !APR_BUCKET_IS_EOS(e)) {
         const char *bucket_data;
         apr_size_t bucket_data_len;
         const char *src;
@@ -706,7 +707,7 @@ static int getsfunc_BRIGADE(char *buf, int len, void *arg)
         e = next;
     }
     *dst = 0;
-    return 1;
+    return done;
 }
 
 AP_DECLARE(int) ap_scan_script_header_err_brigade(request_rec *r,