]> granicus.if.org Git - apache/commitdiff
Avoid passing too many characters to getenv. Make sure that only the
authorBradley Nicholes <bnicholes@apache.org>
Wed, 12 Feb 2003 17:17:09 +0000 (17:17 +0000)
committerBradley Nicholes <bnicholes@apache.org>
Wed, 12 Feb 2003 17:17:09 +0000 (17:17 +0000)
environment variable string is passed.

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

server/util.c

index 330a5411534e8e1244271fa5a37f209063f270d9..246274edf5db033cbd2e842dec7d2c3c4489e2a5 100644 (file)
@@ -837,8 +837,10 @@ AP_DECLARE(const char *) ap_resolve_env(apr_pool_t *p, const char * word)
                strncat(tmp,word,s - word);
                if ((s[1] == '{') && (e=ap_strchr_c(s,'}'))) {
                        const char *e2 = e;
+                       char *var;
                        word = e + 1;
-                       e = getenv(s+2);
+                       var = apr_pstrndup(p, s+2, e2-(s+2));
+                       e = getenv(var);
                        if (e) {
                            strcat(tmp,e);
                        } else {