Subject: | Net::SSLeay::tcp_read_all memory allocation workaround. |
Distribution name and version - Net_SSLeay
Perl version - 5.8.7
Operating System vendor and version - Linux 2.6.11
make test Failed log:
Show quoted text
> % make test
> make[1]: Entering directory `/usr/local/src/deb-src/libnet-ssleay-perl/libnet-ssleay-perl-1.25/Net-SSLeay-Handle-0.50'
> make[1]: Leaving directory `/usr/local/src/deb-src/libnet-ssleay-perl/libnet-ssleay-perl-1.25/Net-SSLeay-Handle-0.50'
> PERL_DL_NONLAZY=1 /usr/bin/perl "-Iblib/lib" "-Iblib/arch" test.pl
> 1..20
> ok 1
> Testing pointer to int casting...
> cc: cc
> ok
> ./ptrcasttst: 'void *' len: 4, 'unsigned long int' len: 4.
> ptrcasttst: ok (0x804a008 == 0x804a008).
> ok
> ok
> ok 2
> ok 3
> ok 4
> Spawning a TCP test server on port 1211, pid=1722...
> Out of memory!
> *** not ok 5tcp
>
> Spawning a SSL test server on port 1212, pid=1726...
> ok 5
Attached patch will resolve this memory allocation fail,
so id 3287 bug and id 11222 bug will fix.
HIBINO Kei
--- Net_SSLeay.pm-1.25/SSLeay.pm.orig 2003-08-18 00:24:32.000000000 +0900
+++ Net_SSLeay.pm-1.25/SSLeay.pm 2005-10-25 18:31:07.000000000 +0900
@@ -1609,8 +1609,9 @@
my ($n, $got, $errs);
my $reply = '';
+ my $bsize = 0x10000;
while ($how_much > 0) {
- $n = sysread(SSLCAT_S,$got,$how_much);
+ $n = sysread(SSLCAT_S,$got, (($bsize < $how_much) ? $bsize : $how_much));
warn "Read error: $! ($n,$how_much)" unless defined $n;
last if !$n; # EOF
$how_much -= $n;