This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[patch] Re: Perl PR: "Security holes in Sys::Syslog"
authorPhilippe M. Chiasson <gozer@ActiveState.com>
Wed, 30 Nov 2005 20:17:31 +0000 (12:17 -0800)
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Thu, 1 Dec 2005 09:26:01 +0000 (09:26 +0000)
From: "Philippe M. Chiasson" <gozer@ActiveState.com>
Message-ID: <438E795B.9060805@ActiveState.com>

p4raw-id: //depot/perl@26235

sv.c

diff --git a/sv.c b/sv.c
index 20bc9c1..10aecd5 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -8909,6 +8909,10 @@ Perl_sv_vcatpvfn(pTHX_ SV *sv, const char *pat, STRLEN patlen, va_list *args, SV
        need = (have > width ? have : width);
        gap = need - have;
 
+#ifdef PERL_MALLOC_WRAP
+       if (need >= (((STRLEN)~0) - SvCUR(sv) - dotstrlen - 1))
+           Perl_croak_nocontext(PL_memory_wrap);
+#endif
        SvGROW(sv, SvCUR(sv) + need + dotstrlen + 1);
        p = SvEND(sv);
        if (esignlen && fill == '0') {