summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorYves Orton <demerphq@gmail.com>2016-04-08 20:46:43 +0200
committerYves Orton <demerphq@gmail.com>2016-04-08 21:30:50 +0200
commite19cb11142087974d956f263d24e146b968025d5 (patch)
treee69f738c8739116ba391657c3d192afc5a426fc2 /sv.c
parentd14d5855c45a17996ec1e16e2f3cfa8ecef24809 (diff)
downloadperl-e19cb11142087974d956f263d24e146b968025d5.tar.gz
fix #127855, in Perl_sv_setpvn() we have to overallocate to enable COW
We need to overallocate by 2 to do COW strings. One for the null, one for the refcount.
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 0200679087..68df702b56 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 + 1);
+ dptr = SvGROW(sv, len + 2);
Move(ptr,dptr,len,char);
dptr[len] = '\0';
SvCUR_set(sv, len);