Protect Perl_sv_2pvbyte () to NULL length pointers
H.Merijn Brand [Wed, 15 Jun 2005 13:57:57 +0000 (13:57 +0000)]
Thanks Nick!

p4raw-id: //depot/perl@24850

sv.c

diff --git a/sv.c b/sv.c
index 4035241..bd49a28 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -3775,7 +3775,7 @@ char *
 Perl_sv_2pvbyte(pTHX_ register SV *sv, STRLEN *lp)
 {
     sv_utf8_downgrade(sv,0);
-    return SvPV(sv,*lp);
+    return lp ? SvPV(sv,*lp) : SvPV_nolen(sv);
 }
 
 /*