Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
*) Bugfix for ArrayIndexOutOfBoundsException during SSL detection See: http://www.yacy-forum.de/viewtopic.php?p=28247#28247
theli954db729db75
diff --git a/source/de/anomic/server/serverCoreSocket.java b/source/de/anomic/server/serverCoreSocket.javaindex 823953196..33c9dabdb 100644--- a/source/de/anomic/server/serverCoreSocket.java+++ b/source/de/anomic/server/serverCoreSocket.java@@ -77,9 +77,17 @@ public class serverCoreSocket extends Socket {private void detectSSL() throws IOException {InputStream in = getInputStream();- // read the first 6 bytes to determine the protocol type+ // read the first 5 bytes to determine the protocol typebyte[] preRead = new byte[5];- int read = in.read(preRead);+ int read, count = 0;+ while ((count < preRead.length) && ((read = in.read()) != -1)) {+ preRead[count] = (byte) read;+ count++;+ }+ if (count < preRead.length) {+ ((PushbackInputStream) in).unread(preRead,0,count);+ return;+ }int idx = 0;if ((preRead[0] & 0xFF) == 22) {@@ -114,7 +122,7 @@ public class serverCoreSocket extends Socket {}// unread pre read bytes- ((PushbackInputStream) in).unread(preRead,0,read);+ ((PushbackInputStream) in).unread(preRead);}public InetAddress getInetAddress() {