]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Merge r1906940 from trunk:
authorEric Covener <covener@apache.org>
Fri, 3 Mar 2023 14:21:26 +0000 (14:21 +0000)
committerEric Covener <covener@apache.org>
Fri, 3 Mar 2023 14:21:26 +0000 (14:21 +0000)
* Report an error if the AJP backend sends an invalid number of headers

Reviewed By: rpluem, covener, ylavic

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

changes-entries/ajp_invalid_number_of_headers.txt [new file with mode: 0644]
modules/proxy/ajp_header.c

diff --git a/changes-entries/ajp_invalid_number_of_headers.txt b/changes-entries/ajp_invalid_number_of_headers.txt
new file mode 100644 (file)
index 0000000..8657304
--- /dev/null
@@ -0,0 +1,2 @@
+  *) mod_proxy_ajp: Report an error if the AJP backend sends an invalid number
+     of headers. [Ruediger Pluem]
index b4dc47ccf501a30f2203c3d87ca753f169de8b50..a09a2e43a363eae2c7093cacabcbc5a6f7689c59 100644 (file)
@@ -584,8 +584,15 @@ static apr_status_t ajp_unmarshal_response(ajp_msg_t *msg,
         r->headers_out = save_table;
     }
     else {
-        r->headers_out = NULL;
+        /*
+         * Reset headers, but not to NULL because things below the chain expect
+         * this to be non NULL e.g. the ap_content_length_filter.
+         */
+        r->headers_out = apr_table_make(r->pool, 1);
         num_headers = 0;
+        ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(10405)
+                "ajp_unmarshal_response: Bad number of headers");
+        return rc;
     }
 
     ap_log_rerror(APLOG_MARK, APLOG_TRACE4, 0, r,