diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 1999-09-24 18:19:54 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 1999-09-24 18:19:54 +0000 |
commit | 84e30d1a3b7cc368d7f93dd2b009e9fd64756759 (patch) | |
tree | 532d2c5ac15a51769d6c59b7aa41dfa4613b0d52 | |
parent | b6fbb8a80bb346d2cf570d95f2cd4a86144bf596 (diff) | |
download | perl-84e30d1a3b7cc368d7f93dd2b009e9fd64756759.tar.gz |
avoid infinite recursive exec()s of perl.exe when shebang
contains "Perl" rather than "perl" on DOSISH platforms
p4raw-id: //depot/perl@4225
-rw-r--r-- | toke.c | 18 |
1 files changed, 17 insertions, 1 deletions
@@ -2425,8 +2425,24 @@ Perl_yylex(pTHX) * Look for options. */ d = instr(s,"perl -"); - if (!d) + if (!d) { d = instr(s,"perl"); +#if defined(DOSISH) + /* avoid getting into infinite loops when shebang + * line contains "Perl" rather than "perl" */ + if (!d) { + for (d = ipathend-4; d >= ipath; --d) { + if ((*d == 'p' || *d == 'P') + && !ibcmp(d, "perl", 4)) + { + break; + } + } + if (d < ipath) + d = Nullch; + } +#endif + } #ifdef ALTERNATE_SHEBANG /* * If the ALTERNATE_SHEBANG on this system starts with a |