]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
core: Fix incorrect substitution of env vars in directives containing multiple env...
authorHank Ibell <hwibell@apache.org>
Wed, 5 Dec 2018 19:13:38 +0000 (19:13 +0000)
committerHank Ibell <hwibell@apache.org>
Wed, 5 Dec 2018 19:13:38 +0000 (19:13 +0000)
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.

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

CHANGES
server/core.c

diff --git a/CHANGES b/CHANGES
index 31d44bc20bb764f9cb12aec3131fcb01a5d73319..032f68ac8dfe199ff245d289508b2522377ea304 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,9 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.5.1
 
+  *) core: Incorrect values for environment variables are substituted when
+     multiple environment variables are specified in a directive. [Hank Ibell]
+
   *) core: Split out the ability to parse wildcard files and directories
      from the Include/IncludeOptional directives into a generic set of
      functions ap_dir_nofnmatch() and ap_dir_fnmatch(). [Graham Leggett]
index 92245b3d64664ae75d8e924f6e3fd250456385ac..2ada06ab3cc04416c279d9de4f94211695000f84 100644 (file)
@@ -1441,7 +1441,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);