Bug in CGI.pm - uploaded file size
Lincoln Stein
lstein na cshl.edu
Úterý Červenec 29 00:39:11 MEST 2003
Fixed long, long ago. You're 10 revisions behind.
Lincoln
On Monday 28 July 2003 11:47 am, Jan Kasprzak wrote:
> Hello,
>
> I have discovered a bug in CGI.pm - it computes incorrectly
> the size of the uploaded file. When the length of the uploaded file
> is 4095 bytes, it transfers 4096 bytes leaving an extra \r at the end
> of the file. The value 4095 depends probably of the $FILLUNIT constant.
> The patch against the version of CGI.pm labeled
>
> $CGI::revision = '$Id: CGI.pm,v 1.75 2002/10/16 17:48:37 lstein Exp $';
> $CGI::VERSION='2.89';
>
> is the following:
>
> --- CGI.pm.orig 2003-07-28 17:39:36.000000000 +0200
> +++ CGI.pm 2003-07-28 17:40:16.000000000 +0200
> @@ -3392,8 +3392,10 @@
> substr($self->{BUFFER},0,$bytesToReturn)='';
>
> # If we hit the boundary, remove the CRLF from the end.
> - return (($start > 0) && ($start <= $bytes))
> - ? substr($returnval,0,-2) : $returnval;
> + # MIND THE GAP: compute the end offset from $start, not from
> + # length($returnval)! -Jan "Yenya" Kasprzak, 2003-07-28
> + return (($start > 0) && ($start - 2 < $bytes))
> + ? substr($returnval,0,$start-2) : $returnval;
> }
> END_OF_FUNC
>
> Please let me know if you accept this patch. Thanks,
>
> -Yenya
--
========================================================================
Lincoln D. Stein Cold Spring Harbor Laboratory
lstein na cshl.org Cold Spring Harbor, NY
========================================================================
Další informace o konferenci Perl