683572
From 1d84a25665013f389ffc6fad7dd133f1c6287a08 Mon Sep 17 00:00:00 2001
683572
From: David Mitchell <davem@iabyn.com>
683572
Date: Tue, 6 Aug 2019 14:36:45 +0100
683572
Subject: [PATCH] include a trailing \0 in SVs holding trie info
683572
MIME-Version: 1.0
683572
Content-Type: text/plain; charset=UTF-8
683572
Content-Transfer-Encoding: 8bit
683572
683572
RT #13427
683572
683572
TRIE_STORE_REVCHAR() was creating SvPV()s with no trailing '\0'. This
683572
doesn't really matter given the specialised use these are put to, but
683572
it upset valgrind et al when perl was run with -Drv which printf("%s")'s
683572
the contents of the string.
683572
683572
Signed-off-by: Petr Písař <ppisar@redhat.com>
683572
---
683572
 regcomp.c | 3 ++-
683572
 1 file changed, 2 insertions(+), 1 deletion(-)
683572
683572
diff --git a/regcomp.c b/regcomp.c
683572
index 370221f72e..1117998fc8 100644
683572
--- a/regcomp.c
683572
+++ b/regcomp.c
683572
@@ -2526,7 +2526,8 @@ is the recommended Unicode-aware way of saying
683572
 	if (UTF) {							   \
683572
             SV *zlopp = newSV(UTF8_MAXBYTES);				   \
683572
 	    unsigned char *flrbbbbb = (unsigned char *) SvPVX(zlopp);	   \
683572
-            unsigned const char *const kapow = uvchr_to_utf8(flrbbbbb, val); \
683572
+            unsigned char *const kapow = uvchr_to_utf8(flrbbbbb, val);     \
683572
+            *kapow = '\0';                                                 \
683572
 	    SvCUR_set(zlopp, kapow - flrbbbbb);				   \
683572
 	    SvPOK_on(zlopp);						   \
683572
 	    SvUTF8_on(zlopp);						   \
683572
-- 
683572
2.20.1
683572