Gisle notes that SvRTRIM should also write a new '\0' at the end.
Nicholas Clark [Wed, 11 Jan 2006 12:11:03 +0000 (12:11 +0000)]
p4raw-id: //depot/perl@26781

mg.c

diff --git a/mg.c b/mg.c
index 87cea48..603e8ac 100644 (file)
--- a/mg.c
+++ b/mg.c
@@ -647,6 +647,7 @@ Perl_magic_len(pTHX_ SV *sv, MAGIC *mg)
     while (len > 0 && isSPACE(p[len-1])) \
        --len; \
     SvCUR_set(sv, len); \
+    p[len] = '\0'; \
 } STMT_END
 
 int