By grabbing the length, we can use sv_setpvn here.
Nicholas Clark [Thu, 30 Jun 2005 17:41:03 +0000 (17:41 +0000)]
p4raw-id: //depot/perl@25031

util.c

diff --git a/util.c b/util.c
index fb7108f..4da13d4 100644 (file)
--- a/util.c
+++ b/util.c
@@ -4032,8 +4032,9 @@ Perl_new_version(pTHX_ SV *ver)
     if ( SvVOK(ver) ) { /* already a v-string */
        char *version;
        MAGIC* mg = mg_find(ver,PERL_MAGIC_vstring);
-       version = savepvn( (const char*)mg->mg_ptr,mg->mg_len );
-       sv_setpv(rv,version);
+       const STRLEN len = mg->mg_len;
+       version = savepvn( (const char*)mg->mg_ptr, len);
+       sv_setpvn(rv,version,len);
        Safefree(version);
     }
     else {