Apply by doing:
       cd /usr/src
       patch -p0 < 006_perl_zlib.patch

Then rebuild and install perl:
       cd gnu/usr.bin/perl
       make -f Makefile.bsd-wrapper obj
       make -f Makefile.bsd-wrapper depend
       make -f Makefile.bsd-wrapper
       make -f Makefile.bsd-wrapper install

Index: gnu/usr.bin/perl/ext/Compress/Raw/Zlib/Zlib.xs
===================================================================
RCS file: /cvs/src/gnu/usr.bin/perl/ext/Compress/Raw/Zlib/Zlib.xs,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 Zlib.xs
--- gnu/usr.bin/perl/ext/Compress/Raw/Zlib/Zlib.xs      29 Sep 2008 17:18:14 -0000      1.1.1.1
+++ gnu/usr.bin/perl/ext/Compress/Raw/Zlib/Zlib.xs      21 Jun 2009 15:34:44 -0000
@@ -1295,7 +1295,7 @@

        if (s->stream.avail_out == 0 ) {
           /* out of space in the output buffer so make it bigger */
-            Sv_Grow(output, SvLEN(output) + bufinc) ;
+            Sv_Grow(output, SvLEN(output) + bufinc +1) ;
            cur_length += increment ;
            s->stream.next_out = (Bytef*) SvPVbyte_nolen(output) + cur_length ;
            increment = bufinc ;