diff options
author | Milosz Tanski <mtanski@gridapp.com> | 2008-08-05 14:33:02 -0400 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2008-08-24 15:23:41 +0000 |
commit | 9d27dca99b7a70de3c674d084792e402944a2c0c (patch) | |
tree | 53e75e3b5c9c5e525bf3159646f3d7e2ba44bca6 /perl.c | |
parent | 777723442a58c6c86c224d8d746a30441a5bdfbd (diff) | |
download | perl-9d27dca99b7a70de3c674d084792e402944a2c0c.tar.gz |
Safer environ iteration
From: "Milosz Tanski" <mtanski@gridapp.com>
Message-ID: <C0A5E31718FC064A91E9FD7BE2F081B1018A21D7@exchange.gridapp.com>
p4raw-id: //depot/perl@34225
Diffstat (limited to 'perl.c')
-rw-r--r-- | perl.c | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -4671,18 +4671,21 @@ S_init_postdump_symbols(pTHX_ register int argc, register char **argv, register environ[0] = NULL; } if (env) { - char *s; + char *s, *old_var; SV *sv; for (; *env; env++) { - if (!(s = strchr(*env,'=')) || s == *env) + old_var = *env; + + if (!(s = strchr(old_var,'=')) || s == old_var) continue; + #if defined(MSDOS) && !defined(DJGPP) *s = '\0'; - (void)strupr(*env); + (void)strupr(old_var); *s = '='; #endif sv = newSVpv(s+1, 0); - (void)hv_store(hv, *env, s - *env, sv, 0); + (void)hv_store(hv, old_var, s - old_var, sv, 0); if (env_is_not_environ) mg_set(sv); } |