diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2003-07-30 10:06:24 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2003-07-30 10:06:24 +0000 |
commit | c8941eeb733f47411a44a1bbe9e04e8f3fca095d (patch) | |
tree | 338c0b5997c973e795532a53462c75e5d677c8cd /perl.c | |
parent | 979e2c82f30d09c274a788ff4bf7541f3ff9db3d (diff) | |
download | perl-c8941eeb733f47411a44a1bbe9e04e8f3fca095d.tar.gz |
Be paranoid about PL_origargv.
Paranoia warranted by Win32 mod_perl.
p4raw-id: //depot/perl@20343
Diffstat (limited to 'perl.c')
-rw-r--r-- | perl.c | 35 |
1 files changed, 18 insertions, 17 deletions
@@ -952,26 +952,27 @@ setuid perl scripts securely.\n"); * PTRSIZE bytes. As long as no system has something bizarre * like the argv[] interleaved with some other data, we are * fine. (Did I just evoke Murphy's Law?) --jhi */ - s = PL_origargv[0]; - while (*s) s++; - for (i = 1; i < PL_origargc; i++) { - if ((PL_origargv[i] == s + 1 + if (PL_origargv && PL_origargc >= 1 && (s = PL_origargv[0])) { + while (*s) s++; + for (i = 1; i < PL_origargc; i++) { + if ((PL_origargv[i] == s + 1 #ifdef OS2 - || PL_origargv[i] == s + 2 + || PL_origargv[i] == s + 2 #endif - ) - || - (aligned && - (PL_origargv[i] > s && - PL_origargv[i] <= - INT2PTR(char *, PTR2UV(s + PTRSIZE) & mask))) - ) - { - s = PL_origargv[i]; - while (*s) s++; + ) + || + (aligned && + (PL_origargv[i] > s && + PL_origargv[i] <= + INT2PTR(char *, PTR2UV(s + PTRSIZE) & mask))) + ) + { + s = PL_origargv[i]; + while (*s) s++; + } + else + break; } - else - break; } /* Can we grab env area too to be used as the area for $0? */ if (PL_origenviron) { |