summaryrefslogtreecommitdiff
path: root/perl.c
diff options
context:
space:
mode:
authorGisle Aas <gisle@activestate.com>2006-01-10 08:58:21 +0000
committerGisle Aas <gisle@activestate.com>2006-01-10 08:58:21 +0000
commit2d2af554da24863760d055834f4984fbca7ec85b (patch)
tree99ca4a308dba0bbab27f7e2b008e3a91dcbe8fc1 /perl.c
parent11e2783cff6b99a1463ba0eb8e30a005fc688aaf (diff)
downloadperl-2d2af554da24863760d055834f4984fbca7ec85b.tar.gz
Avoid possible dereference of NULL in the initialization of PL_origalen.
This can only happen when perlparse is called with no argv. Don't try to update PL_origargv unless PL_origalen is at least 2. p4raw-id: //depot/perl@26760
Diffstat (limited to 'perl.c')
-rw-r--r--perl.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/perl.c b/perl.c
index a76307d976..b1671d956d 100644
--- a/perl.c
+++ b/perl.c
@@ -1487,7 +1487,7 @@ setuid perl scripts securely.\n");
}
}
/* Can we grab env area too to be used as the area for $0? */
- if (PL_origenviron) {
+ if (s && PL_origenviron) {
if ((PL_origenviron[0] == s + 1
#ifdef OS2
|| (PL_origenviron[0] == s + 9 && (s += 8))
@@ -1523,7 +1523,7 @@ setuid perl scripts securely.\n");
}
}
}
- PL_origalen = s - PL_origargv[0] + 1;
+ PL_origalen = s ? s - PL_origargv[0] + 1 : 0;
}
if (PL_do_undump) {