]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Merge r1848236 from trunk:
authorJim Jagielski <jim@apache.org>
Tue, 11 Dec 2018 14:16:13 +0000 (14:16 +0000)
committerJim Jagielski <jim@apache.org>
Tue, 11 Dec 2018 14:16:13 +0000 (14:16 +0000)
core: Fix incorrect substitution of env vars in directives containing multiple env vars.

In ap_resolve_env(), the string returned from getenv() should be copied since
the returned string may be statically allocated.

This fixes an issue where the value for the last env var is substituted for all
env vars in a directive containing multiple env vars.

Submitted by: hwibell
Reviewed by: hwibell, covener, jim

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

CHANGES
STATUS
server/core.c

diff --git a/CHANGES b/CHANGES
index 88e5320671ba559ca1bcbc6290e3f27ea474b481..a9b1d6bdf12e29936aca1e1238b18454c8cbf640 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -6,6 +6,9 @@ Changes with Apache 2.4.38
      and we should just set the value for the environment variable 
      like in the pattern case. [Christophe Jaillet]
 
+  *) core: Incorrect values for environment variables are substituted when
+     multiple environment variables are specified in a directive. [Hank Ibell]
+
   *) mod_rewrite: Only create the global mutex used by "RewriteMap prg:" when
      this type of map is present in the configuration.  PR62311.  
      [Hank Ibell <hwibell gmail.com>]
diff --git a/STATUS b/STATUS
index 7ec7e620959fae2da9a4049ed6c07f9cd78bded3..3c2c563b8e31c53d4b9d86ccd174dcea9db26a2b 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -126,13 +126,6 @@ RELEASE SHOWSTOPPERS:
 PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
   [ start all new proposals below, under PATCHES PROPOSED. ]
 
-  *) core: Fix incorrect substitution of env vars in directives containing
-           multiple env vars. In ap_resolve_env(), the string returned from
-           getenv() should be copied since the returned string may be 
-           statically allocated.
-     trunk patch: http://svn.apache.org/r1848236
-     2.4.x patch: svn merge -c 1848236 ^/httpd/httpd/trunk .
-     +1: hwibell, covener, jim
 
 PATCHES PROPOSED TO BACKPORT FROM TRUNK:
   [ New proposals should be added at the end of the list ]
index aa62e15267a08efb17f228907b66fd658e184334..e2a91c7a0c6dd577e7e24dd079aec079aa5acdcc 100644 (file)
@@ -1361,7 +1361,7 @@ AP_DECLARE(const char *) ap_resolve_env(apr_pool_t *p, const char * word)
                 if (server_config_defined_vars)
                     word = apr_table_get(server_config_defined_vars, name);
                 if (!word)
-                    word = getenv(name);
+                    word = apr_pstrdup(p, getenv(name));
                 if (word) {
                     current->string = word;
                     current->len = strlen(word);