From e01c5899dd5c15c076ff80faae646f1bb851ca52 Mon Sep 17 00:00:00 2001 From: Hugo van der Sanden Date: Thu, 11 Mar 2004 16:21:50 +0000 Subject: [PATCH] Fix a bug in the cloning of regexps Subject: Re: [perl #27530] Regex qr// interpolation fails when chr(0) is used in a thread Message-Id: <200403111621.i2BGLoi20225@zen.crypt.org> (plus another similar fix) p4raw-id: //depot/perl@22490 --- sv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sv.c b/sv.c index 70e157d..2d46839 100644 --- a/sv.c +++ b/sv.c @@ -9715,7 +9715,7 @@ Perl_re_dup(pTHX_ REGEXP *r, CLONE_PARAMS *param) New(0, ret->offsets, 2*len+1, U32); Copy(r->offsets, ret->offsets, 2*len+1, U32); - ret->precomp = SAVEPV(r->precomp); + ret->precomp = SAVEPVN(r->precomp, r->prelen); ret->refcnt = r->refcnt; ret->minlen = r->minlen; ret->prelen = r->prelen; @@ -9727,7 +9727,7 @@ Perl_re_dup(pTHX_ REGEXP *r, CLONE_PARAMS *param) ret->sublen = r->sublen; if (RX_MATCH_COPIED(ret)) - ret->subbeg = SAVEPV(r->subbeg); + ret->subbeg = SAVEPVN(r->subbeg, r->sublen); else ret->subbeg = Nullch; #ifdef PERL_COPY_ON_WRITE -- 2.7.4