Integrate change #12200 from maintperl;
Jarkko Hietaniemi [Tue, 25 Sep 2001 16:52:03 +0000 (16:52 +0000)]
on windows, virtualized environment could propagate deleted variables
into children if they happen to be at the very end of the table

p4raw-link: @12200 on //depot/maint-5.6/perl: a54e6844a84a87ee0c736e691b5bedbfcbccb5bd

p4raw-id: //depot/perl@12201
p4raw-integrated: from //depot/maint-5.6/perl@12199 'merge in'
win32/perlhost.h (@12146..)

win32/perlhost.h

index 1714601..3e22dba 100644 (file)
@@ -2269,11 +2269,12 @@ CPerlHost::CreateLocalEnvironmentStrings(VDir &vDir)
 
        while(lpLocalEnv) {
            // still have environment overrides to add
-           // so copy the strings into place
-           strcpy(lpStr, lpLocalEnv);
-           nLength = strlen(lpLocalEnv) + 1;
-           lpStr += nLength;
-           lpEnvPtr += nLength;
+           // so copy the strings into place if not an override
+           char *ptr = strchr(lpLocalEnv, '=');
+           if(ptr && ptr[1]) {
+               strcpy(lpStr, lpLocalEnv);
+               lpStr += strlen(lpLocalEnv) + 1;
+           }
            lpLocalEnv = GetIndex(dwEnvIndex);
        }