summaryrefslogtreecommitdiff
path: root/perl.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2003-07-30 10:06:24 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2003-07-30 10:06:24 +0000
commitc8941eeb733f47411a44a1bbe9e04e8f3fca095d (patch)
tree338c0b5997c973e795532a53462c75e5d677c8cd /perl.c
parent979e2c82f30d09c274a788ff4bf7541f3ff9db3d (diff)
downloadperl-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.c35
1 files changed, 18 insertions, 17 deletions
diff --git a/perl.c b/perl.c
index eb86c7238e..3600eb92c7 100644
--- a/perl.c
+++ b/perl.c
@@ -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) {