]> granicus.if.org Git - apache/commitdiff
Always log if LimitRequestFieldSize triggers.
authorRainer Jung <rjung@apache.org>
Sun, 22 Jul 2012 11:32:47 +0000 (11:32 +0000)
committerRainer Jung <rjung@apache.org>
Sun, 22 Jul 2012 11:32:47 +0000 (11:32 +0000)
Backport of r1352911 from trunk.

Submitted by: sf
Reviewed by: rjung, trawick
Backported by: rjung

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

CHANGES
STATUS
server/protocol.c

diff --git a/CHANGES b/CHANGES
index 676fc95d27d2ab950f4a87cd01586d21c5d9e804..5ab050db835d7186ddd35dd8750226d4054fa0c4 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -8,6 +8,8 @@ Changes with Apache 2.4.3
      possible XSS for a site where untrusted users can upload files to
      a location with MultiViews enabled. [Niels Heinen <heinenn google.com>]
 
+  *) core: Always log if LimitRequestFieldSize triggers.  [Stefan Fritsch]
+
   *) mod_deflate: Skip compression if compression is enabled at SSL level.
      [Stefan Fritsch]
 
diff --git a/STATUS b/STATUS
index 3cec8e6b225fe6463e15f50662467c8c786b23ba..52d1be6e0f666dc183c911d3a4f692755e0b0912 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -88,11 +88,6 @@ RELEASE SHOWSTOPPERS:
 PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
   [ start all new proposals below, under PATCHES PROPOSED. ]
 
-   * core: Always log if LimitRequestFieldSize triggers
-     trunk patch: http://svn.apache.org/viewvc?view=revision&revision=1352911
-     2.4.x patch: trunk patch works
-     +1: sf, rjung, trawick
-
    * mod_authz_core: Allow to use %{REMOTE_USER} in Require expr. Improve
      logging.
      PR: 52892
index 4fcff4da40eeb2e0e7d3f3caf288d3e8fb4c3016..30b3cd5eeff20a891bf7bdf46913e4d69a82297b 100644 (file)
@@ -746,19 +746,29 @@ AP_DECLARE(void) ap_get_mime_headers_core(request_rec *r, apr_bucket_brigade *bb
              * finding the end-of-line.  This is only going to happen if it
              * exceeds the configured limit for a field size.
              */
-            if (rv == APR_ENOSPC && field) {
-                /* ensure ap_escape_html will terminate correctly */
-                field[len - 1] = '\0';
+            if (rv == APR_ENOSPC) {
+                const char *field_escaped;
+                if (field) {
+                    /* ensure ap_escape_html will terminate correctly */
+                    field[len - 1] = '\0';
+                    field_escaped = ap_escape_html(r->pool, field);
+                }
+                else {
+                    field_escaped = field = "";
+                }
+
                 apr_table_setn(r->notes, "error-notes",
                                apr_psprintf(r->pool,
                                            "Size of a request header field "
                                            "exceeds server limit.<br />\n"
                                            "<pre>\n%.*s\n</pre>\n", 
-                                           field_name_len(field), 
-                                           ap_escape_html(r->pool, field)));
+                                           field_name_len(field_escaped),
+                                           field_escaped));
                 ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, APLOGNO(00561)
-                              "Request header exceeds LimitRequestFieldSize: "
-                              "%.*s", field_name_len(field), field);
+                              "Request header exceeds LimitRequestFieldSize%s"
+                              "%.*s",
+                              *field ? ": " : "",
+                              field_name_len(field), field);
             }
             return;
         }