summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorYves Orton <demerphq@gmail.com>2016-04-08 21:25:20 +0200
committerYves Orton <demerphq@gmail.com>2016-04-08 21:30:50 +0200
commitbcc9f606509ad2fad50e16f081103451b7dc49e1 (patch)
treea6db50d6af82c1b496504bf7e80902d0ebf66f0b /sv.c
parente19cb11142087974d956f263d24e146b968025d5 (diff)
downloadperl-bcc9f606509ad2fad50e16f081103451b7dc49e1.tar.gz
More generalized fix for #127855, overallocate in SvGROW and not just sv_grow()
If we overallocate in SvGROW() and not just sv_grow() we can ensure we have more cases where we can COW. We need to ensure we always have room for a null and a reference count.
Diffstat (limited to 'sv.c')
-rw-r--r--sv.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sv.c b/sv.c
index 68df702b56..0200679087 100644
--- a/sv.c
+++ b/sv.c
@@ -4891,7 +4891,7 @@ Perl_sv_setpvn(pTHX_ SV *const sv, const char *const ptr, const STRLEN len)
}
SvUPGRADE(sv, SVt_PV);
- dptr = SvGROW(sv, len + 2);
+ dptr = SvGROW(sv, len + 1);
Move(ptr,dptr,len,char);
dptr[len] = '\0';
SvCUR_set(sv, len);