]> granicus.if.org Git - php/commitdiff
Fix #4230. Putenv() was modifying its argument, a no-no.
authorJouni Ahto <jah@php.net>
Sun, 21 May 2000 21:13:32 +0000 (21:13 +0000)
committerJouni Ahto <jah@php.net>
Sun, 21 May 2000 21:13:32 +0000 (21:13 +0000)
ext/standard/basic_functions.c

index cdbc5bbccbab3cc00a9ecb0145586305d9d45418..4a1aa32a0dbed15f35870a5aff3b80193e57f3ca 100644 (file)
@@ -824,12 +824,11 @@ PHP_FUNCTION(putenv)
                PLS_FETCH();
                
                pe.putenv_string = estrndup((*str)->value.str.val,(*str)->value.str.len);
-               pe.key = (*str)->value.str.val;
+               pe.key = estrndup((*str)->value.str.val, (*str)->value.str.len);
                if ((p=strchr(pe.key,'='))) { /* nullify the '=' if there is one */
                        *p='\0';
                }
                pe.key_len = strlen(pe.key);
-               pe.key = estrndup(pe.key,pe.key_len);
                
                if (PG(safe_mode)) {
                        /* Check the protected list */