You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bi...@apache.org on 2002/08/08 04:55:35 UTC

cvs commit: jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/filters ChunkedInputFilter.java

billbarker    2002/08/07 19:55:35

  Modified:    http11/src/java/org/apache/coyote/http11/filters
                        ChunkedInputFilter.java
  Log:
  Don't read past end of buffer.
  
  Fix for Bug #11117.
  Reported By: Michael Smith msmith@ns.xn.com.au
  Submitted By: Michael Smith msmith@ns.xn.com.au
  
  Revision  Changes    Path
  1.6       +11 -1     jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/filters/ChunkedInputFilter.java
  
  Index: ChunkedInputFilter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/filters/ChunkedInputFilter.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ChunkedInputFilter.java	20 Jun 2002 11:14:30 -0000	1.5
  +++ ChunkedInputFilter.java	8 Aug 2002 02:55:35 -0000	1.6
  @@ -136,6 +136,11 @@
        */
       protected boolean endChunk = false;
   
  +    /**
  +     * Flag set to true if the next call to doRead() must parse a CRLF pair
  +     * before doing anything else.
  +     */
  +    protected boolean needCRLFParse = false;
   
       // ------------------------------------------------------------- Properties
   
  @@ -158,6 +163,11 @@
           if (endChunk)
               return -1;
   
  +        if(needCRLFParse) {
  +            needCRLFParse = false;
  +            parseCRLF();
  +        }
  +
           if (remaining <= 0) {
               if (!parseChunkHeader()) {
                   throw new IOException("Invalid chunk");
  @@ -184,7 +194,7 @@
               chunk.setBytes(buf, pos, remaining);
               pos = pos + remaining;
               remaining = 0;
  -            parseCRLF();
  +            needCRLFParse = true;
           }
   
           return result;
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>