Commit 71cb5055 authored by Jim Jagielski's avatar Jim Jagielski
Browse files

Merge r1848236 from trunk:

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
parent 70639d38
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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>]
+0 −7
Original line number Diff line number Diff line
@@ -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 ]
+1 −1
Original line number Diff line number Diff line
@@ -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);