Blob Blame History Raw
From 4ee6d47e40a527e4c233362109985a421d784c2d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Tue, 27 Sep 2016 16:03:16 +0200
Subject: [PATCH 2/2] Stringify tainted version object on perl older than
 5.17.2
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Since version-0.9908, version->new() accepts tainted input after
4bac9ae47b5ad7845a24e26b0e95609805de688a change (Magic flags
harmonization) in perl 5.17.2.

But it cannot stringify resultin version object and returns undef
instead.

This patch adds support for the stringification.

CPAN RT#118087

Signed-off-by: Petr Písař <ppisar@redhat.com>
---
 vutil/vutil.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/vutil/vutil.c b/vutil/vutil.c
index c5edb10..f17fb0a 100644
--- a/vutil/vutil.c
+++ b/vutil/vutil.c
@@ -916,7 +916,11 @@ Perl_vstringify(pTHX_ SV *vs)
     if (svp) {
 	SV *pv;
 	pv = *svp;
-	if ( SvPOK(pv) )
+    if ( SvPOK(pv)
+#if PERL_VERSION_LT(5,17,2)
+         || SvPOKp(pv)
+#endif
+    )   
 	    return newSVsv(pv);
 	else
 	    return &PL_sv_undef;
-- 
2.7.4