morgand     01/05/01 09:17:37

  Modified:    httpclient/src/java/org/apache/commons/httpclient
                        ResponseInputStream.java
  Log:
  fixed an index out of bounds condition
  
  Revision  Changes    Path
  1.3       +9 -4      
jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/ResponseInputStream.java
  
  Index: ResponseInputStream.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/ResponseInputStream.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ResponseInputStream.java  2001/04/30 22:12:25     1.2
  +++ ResponseInputStream.java  2001/05/01 16:17:33     1.3
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/ResponseInputStream.java,v
 1.2 2001/04/30 22:12:25 morgand Exp $
  - * $Revision: 1.2 $
  - * $Date: 2001/04/30 22:12:25 $
  + * $Header: 
/home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/ResponseInputStream.java,v
 1.3 2001/05/01 16:17:33 morgand Exp $
  + * $Revision: 1.3 $
  + * $Date: 2001/05/01 16:17:33 $
    *
    * ====================================================================
    *
  @@ -74,7 +74,7 @@
    * Socket input stream wrapper.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Remy Maucherat</a>
  - * @version $Revision: 1.2 $ $Date: 2001/04/30 22:12:25 $
  + * @version $Revision: 1.3 $ $Date: 2001/05/01 16:17:33 $
    */
   
   public class ResponseInputStream
  @@ -260,6 +260,11 @@
               return (-1);
           
           int toCopy = avail;
  +
  +        if (toCopy < 0) {
  +          return (-1);
  +        }
  +
           if (avail > len)
               toCopy = len;
           System.arraycopy(buffer, pos, b, off, toCopy);
  
  
  

Reply via email to