Skip Menu |

This queue is for tickets about the Net-IRR CPAN distribution.

Report information
The Basics
Id: 52134
Status: new
Priority: 0/
Queue: Net-IRR

People
Owner: Nobody in particular
Requestors: gds [...] gds.best.vwh.net
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: corrupted header patch
Date: Fri, 27 Nov 2009 22:50:12 +0000
To: bug-Net-IRR [...] rt.cpan.org
From: Greg Skinner <gds [...] gds.best.vwh.net>
OS OpenBSD 4.3 GENERIC#0 i386 perl, v5.8.8 built for i386-openbsd Net-IRR-0.07 This patch fixes a bug where the header contains something else other than the size in bytes of the result. In this case, the error string is set to report a corrupted header. Likewise, the footer may not contain a legal response code, in which case the error string is set to report a corrupted footer, or no footer. *** IRR-0.07.pm Thu Nov 5 19:00:32 2009 --- IRR.pm Thu Nov 26 14:47:08 2009 *************** *** 180,186 **** return (); } return () if ($header =~ /^[CDEF].*$/); ! my($data_length) = $header =~ /^A(.*)$/; my $data = ''; while($data_length != length($data)) { $data .= $t->getline(); --- 180,190 ---- return (); } return () if ($header =~ /^[CDEF].*$/); ! my($data_length) = $header =~ /^A(\d+)$/; ! if (not defined $data_length) { ! $self->{errstr} = sprintf("%s: corrupt header %s read from %s:%d\n", $error_prefix, $header, $self->{host}, $self->{port}); ! return (); ! } my $data = ''; while($data_length != length($data)) { $data .= $t->getline(); *************** *** 188,194 **** carp sprintf("%s: only received %d out of %d bytes from %s:%d\n", $error_prefix, length($data), $data_length, $self->{host}, $self->{port}) if $data_length != length($data); my $footer = $t->getline(); ! return $data; } sub error { --- 192,208 ---- carp sprintf("%s: only received %d out of %d bytes from %s:%d\n", $error_prefix, length($data), $data_length, $self->{host}, $self->{port}) if $data_length != length($data); my $footer = $t->getline(); ! if (defined $footer) { ! if ($footer =~ /^C/) { ! return $data; ! } ! else { ! $self->{errstr} = sprintf("%s: corrupt footer %s read from %s:%d\n", $error_prefix, $footer, $self->{host}, $self->{port}); ! return (); ! } ! } ! $self->{errstr} = sprintf("%s: no footer read from %s:%d\n", $error_prefix, $self->{host}, $self->{port}); ! return (); } sub error {