summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2001-03-15 01:05:01 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2001-03-15 01:05:01 +0000
commitef38c078f0081ddde8564e6b309e7d682fca627a (patch)
treef667c2d3c3f7d1d4c1d2534658710fd5c4dc24b7 /op.c
parentfc865b05a6e46dfadc1934cb061c1ccca0958ef7 (diff)
downloadperl-ef38c078f0081ddde8564e6b309e7d682fca627a.tar.gz
Avoid stomping off the beginning of an array in tr///.
p4raw-id: //depot/perl@9164
Diffstat (limited to 'op.c')
-rw-r--r--op.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/op.c b/op.c
index 421dc9e69d..64914ea309 100644
--- a/op.c
+++ b/op.c
@@ -2872,11 +2872,8 @@ Perl_pmtrans(pTHX_ OP *o, OP *expr, OP *repl)
}
}
}
- if (!del) {
- if (j >= rlen)
- j = rlen - 1;
- else
- cPVOPo->op_pv = (char*)Renew(tbl, 0x101+rlen-j, short);
+ if (!del && rlen >= j) {
+ cPVOPo->op_pv = (char*)Renew(tbl, 0x101+rlen-j, short);
tbl[0x100] = rlen - j;
for (i=0; i < rlen - j; i++)
tbl[0x101+i] = r[j+i];