This next patch computes right amount of data to read from a socket to
stuff in a Buffer.  When dst.limit < dst.capacity, we're trying to put
too much data into the buffer and we get a buffer overflow exception.

Ok to apply?

Thanks,

AG



2005-12-26  Anthony Green  <[EMAIL PROTECTED]>

        * gnu/java/nio/SocketChannelImpl.java (read): Compute the right amount
        of data to read (dst.remaining()).


--- gnu/java/nio/SocketChannelImpl.java.~1.28.~ 2005-11-11 04:04:03.000000000 
-0800
+++ gnu/java/nio/SocketChannelImpl.java 2005-12-26 17:34:14.000000000 -0800
@@ -220,7 +220,7 @@
     int offset = 0;
     InputStream input = socket.getInputStream();
     int available = input.available();
-    int len = dst.capacity() - dst.position();
+    int len = dst.remaining();
        
     if ((! isBlocking()) && available == 0)
       return 0;




_______________________________________________
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches

Reply via email to