Return-Path: Delivered-To: apmail-incubator-harmony-commits-archive@www.apache.org Received: (qmail 963 invoked from network); 15 Aug 2006 07:05:04 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 15 Aug 2006 07:05:04 -0000 Received: (qmail 29473 invoked by uid 500); 15 Aug 2006 07:05:04 -0000 Delivered-To: apmail-incubator-harmony-commits-archive@incubator.apache.org Received: (qmail 29370 invoked by uid 500); 15 Aug 2006 07:05:04 -0000 Mailing-List: contact harmony-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: harmony-dev@incubator.apache.org Delivered-To: mailing list harmony-commits@incubator.apache.org Received: (qmail 29359 invoked by uid 99); 15 Aug 2006 07:05:04 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 15 Aug 2006 00:05:04 -0700 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [140.211.166.113] (HELO eris.apache.org) (140.211.166.113) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 15 Aug 2006 00:05:03 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 450F41A981A; Tue, 15 Aug 2006 00:04:43 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r431544 - in /incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni: net/PlainSocketImpl.java util/ExternalMessages.properties Date: Tue, 15 Aug 2006 07:04:42 -0000 To: harmony-commits@incubator.apache.org From: pyang@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20060815070443.450F41A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: pyang Date: Tue Aug 15 00:04:42 2006 New Revision: 431544 URL: http://svn.apache.org/viewvc?rev=431544&view=rev Log: Patch applied for HARMONY-1164 ( [classlib][luni] java.net.Socket.connect throws unexpected ArrayIndexOutOfBoundsException when the proxy server replies malformed message.) Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/net/PlainSocketImpl.java incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/util/ExternalMessages.properties Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/net/PlainSocketImpl.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/net/PlainSocketImpl.java?rev=431544&r1=431543&r2=431544&view=diff ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/net/PlainSocketImpl.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/net/PlainSocketImpl.java Tue Aug 15 00:04:42 2006 @@ -558,14 +558,21 @@ * Read a SOCKS V4 reply. */ private Socks4Message socksReadReply() throws IOException { - Socks4Message reply = new Socks4Message(); - int bytesRead = 0; - while (bytesRead < Socks4Message.REPLY_LENGTH) { - bytesRead += getInputStream().read(reply.getBytes(), bytesRead, - Socks4Message.REPLY_LENGTH - bytesRead); - } - return reply; - } + Socks4Message reply = new Socks4Message(); + int bytesRead = 0; + while (bytesRead < Socks4Message.REPLY_LENGTH) { + int count = getInputStream().read(reply.getBytes(), bytesRead, + Socks4Message.REPLY_LENGTH - bytesRead); + if (-1 == count) { + break; + } + bytesRead += count; + } + if (Socks4Message.REPLY_LENGTH != bytesRead) { + throw new SocketException(Msg.getString("KA011")); + } + return reply; + } /** * Connect the socket to the host/port specified by the SocketAddress with a Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/util/ExternalMessages.properties URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/util/ExternalMessages.properties?rev=431544&r1=431543&r2=431544&view=diff ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/util/ExternalMessages.properties (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/util/ExternalMessages.properties Tue Aug 15 00:04:42 2006 @@ -302,3 +302,5 @@ KA00e=Radix {0} is less than Character.MIN_RADIX or greater than Character.MAX_RADIX KA00f=Socket output is shutdown KA010=Cannot read back reference to unshared object +KA011=No such file or directory +KA011=Malformed reply from SOCKS server