diff options
author | Yves Orton <demerphq@gmail.com> | 2022-04-20 06:55:45 +0200 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2022-05-28 15:01:00 -0600 |
commit | 92ec2fce1aace295365d7d86c61c98df8202fc9d (patch) | |
tree | 108331ffd38dba55a6699ab5e0beeed2686131f8 /mg.c | |
parent | 274b07827bad27b0561a9a8b751138474115012d (diff) | |
download | perl-92ec2fce1aace295365d7d86c61c98df8202fc9d.tar.gz |
Revert "Revert "mg.c, Cwd.pm - Empty path is the same as "." which is forbidden under taint""
This reverts commit 9eb153ffbbde62558146e8f9b837034f42878e13.
The patch this unreverts was accidentally pushed to blead without going
through PR or smoke process which it really needs. This patch exists so
it can go through that process.
Diffstat (limited to 'mg.c')
-rw-r--r-- | mg.c | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -1356,6 +1356,15 @@ Perl_magic_setenv(pTHX_ SV *sv, MAGIC *mg) const char path_sep = ':'; #endif +#ifndef __VMS + /* Does this apply for VMS? + * Empty PATH on linux is treated same as ".", which is forbidden + * under taint. So check if the PATH variable is empty. */ + if (!len) { + MgTAINTEDDIR_on(mg); + return 0; + } +#endif /* set MGf_TAINTEDDIR if any component of the new path is * relative or world-writeable */ while (s < strend) { @@ -1372,7 +1381,8 @@ Perl_magic_setenv(pTHX_ SV *sv, MAGIC *mg) /* Using Unix separator, e.g. under bash, so act line Unix */ || (PL_perllib_sep == ':' && *tmpbuf != '/') #else - || *tmpbuf != '/' /* no starting slash -- assume relative path */ + || *tmpbuf != '/' /* no starting slash -- assume relative path */ + || s == strend /* trailing empty component -- same as "." */ #endif || (PerlLIO_stat(tmpbuf, &st) == 0 && (st.st_mode & 2)) ) { MgTAINTEDDIR_on(mg); |