PERL PERL5 CHANGES 44 CHANGE 23337 PATCH FOR PERL C FIXING AN OBSCURE ENVIRONMENT BUG
Date: Tue, 28 Sep 2004 08:59:44 -0700

Subject: Change 23337: Patch for perl.c fixing an obscure environment bug
From: rgarciasuarez@no-spam (Rafael Garcia-Suarez)

Change 23337 by rgs@no-spam on 2004/09/28 15:28:58

Subject: Patch for perl.c fixing an obscure environment bug From: Merijn Broeren <merijnb@no-spam>
Date: Thu, 23 Sep 2004 17:18:17 +0200
Message-ID: <20040923151817.GA15782@no-spam>

Affected files ...

... //depot/perl/perl.c#558 edit
Differences ...

==== //depot/perl/perl.c#558 (text) ====
Index: perl/perl.c --- perl/perl.c#557~23277~ Wed Sep 8 09:49:59 2004
+++ perl/perl.c Tue Sep 28 08:28:58 2004
@@no-spam -4097,9 +4097,10 @@no-spam {
environ[0] = Nullch;
}
- if (env)
+ if (env) {
+ char** origenv = environ;
for (; *env; env++) {
- if (!(s = strchr(*env,'=')))
+ if (!(s = strchr(*env,'=')) || s == *env)
continue;
#if defined(MSDOS) && !defined(DJGPP)
*s = '\0';
@@no-spam -4110,7 +4111,13 @@no-spam (void)hv_store(hv, *env, s - *env, sv, 0);
if (env != environ)
mg_set(sv);
+ if (origenv != environ) {
+ /* realloc has shifted us */
+ env = (env - origenv) + environ;
+ origenv = environ;
+ }
}
+ }
#endif /* USE_ENVIRON_ARRAY */
#endif /* !PERL_MICRO */
}
End of Patch.