]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
mod_substitute: No real functional change, but:
authorRainer Jung <rjung@apache.org>
Wed, 15 Oct 2014 10:02:31 +0000 (10:02 +0000)
committerRainer Jung <rjung@apache.org>
Wed, 15 Oct 2014 10:02:31 +0000 (10:02 +0000)
- define default for maximum line length
  indepenent of MAX_STRING_LEN
- Clarify line length check with a comment
- add supported 'b' suffix to directive
  description

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

modules/filters/mod_substitute.c

index 9fd9caa5d8319ccd94a4dfe6eaff2550831d5988..984249a2cf03f5341940f69128ddcaefd24487e9 100644 (file)
@@ -38,7 +38,7 @@
  * Therefore we limit the resulting length of the line.
  * This is the default value.
  */
-#define AP_SUBST_MAX_LINE_LENGTH (128*MAX_STRING_LEN)
+#define AP_SUBST_MAX_LINE_LENGTH (1024*1024)
 
 static const char substitute_filter_name[] = "SUBSTITUTE";
 
@@ -243,9 +243,13 @@ static apr_status_t do_pattmatch(ap_filter_t *f, apr_bucket *inb,
                         apr_status_t rv;
                         have_match = 1;
                         if (script->flatten && !force_quick) {
-                            /* copy bytes before the match */
+                            /* check remaining buffer size */
+                            /* Note that the last param in ap_varbuf_regsub below
+                             * must stay positive. If it gets 0, it would mean
+                             * unlimited space available. */
                             if (vb.strlen + regm[0].rm_so >= cfg->max_line_length)
                                 return APR_ENOMEM;
+                            /* copy bytes before the match */
                             if (regm[0].rm_so > 0)
                                 ap_varbuf_strmemcat(&vb, pos, regm[0].rm_so);
                             /* add replacement string, last argument is unsigned! */
@@ -672,7 +676,7 @@ static const char *set_max_line_length(cmd_parms *cmd, void *cfg, const char *ar
     if (rv != APR_SUCCESS || max < 0)
     {
         return "SubstituteMaxLineLength must be a non-negative integer optionally "
-               "suffixed with 'k', 'm' or 'g'.";
+               "suffixed with 'b', 'k', 'm' or 'g'.";
     }
     dcfg->max_line_length = (apr_size_t)max;
     dcfg->max_line_length_set = 1;