]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
* modules/core/mod_macro.c (process_content): Return error if there's
authorJoe Orton <jorton@apache.org>
Thu, 12 Sep 2024 08:36:55 +0000 (08:36 +0000)
committerJoe Orton <jorton@apache.org>
Thu, 12 Sep 2024 08:36:55 +0000 (08:36 +0000)
  enough not space to store the macro. Replaced MAX_STRING_LEN by
  sizeof(line).

PR: 69258
Submitted by: Marc Stern <marc.stern approach-cyber.com>
Github: closes #479

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

changes-entries/pr69258.txt [new file with mode: 0644]
modules/core/mod_macro.c

diff --git a/changes-entries/pr69258.txt b/changes-entries/pr69258.txt
new file mode 100644 (file)
index 0000000..fb5f42b
--- /dev/null
@@ -0,0 +1,3 @@
+  *) mod_macro: Return an error if the expanded line would exceed the
+     maximum line length.  PR 69258.
+     [Marc Stern <marc.stern approach-cyber.com>]
index 544a287196ab88e60f25c58638c2a53f6e6b20a0..24d6330d0d481cbaa71f3e275932844ce9cecb2c 100644 (file)
@@ -483,8 +483,13 @@ static const char *process_content(apr_pool_t * pool,
     for (i = 0; i < contents->nelts; i++) {
         const char *errmsg;
         /* copy the line and substitute macro parameters */
-        apr_cpystrn(line, ((char **) contents->elts)[i], MAX_STRING_LEN);
-        errmsg = substitute_macro_args(line, MAX_STRING_LEN,
+       if (strlen(((char**)contents->elts)[i]) >= sizeof(line)) {
+           return apr_psprintf(pool,
+                   "while processing line %d of macro '%s' (%s) %s",
+                   i + 1, macro->name, macro->location, "macro too long");
+       }
+        apr_cpystrn(line, ((char **) contents->elts)[i], sizeof(line));
+        errmsg = substitute_macro_args(line, sizeof(line),
                                        macro, replacements, used);
         if (errmsg) {
             return apr_psprintf(pool,