Author: markt Date: Wed Aug 24 10:24:04 2016 New Revision: 1757485 URL: http://svn.apache.org/viewvc?rev=1757485&view=rev Log: Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=60030 Correct a potential infinite loop in the SNI parsing code triggered by failing to handle an end of stream condition.
Modified: tomcat/trunk/java/org/apache/tomcat/util/net/SecureNioChannel.java tomcat/trunk/webapps/docs/changelog.xml Modified: tomcat/trunk/java/org/apache/tomcat/util/net/SecureNioChannel.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/SecureNioChannel.java?rev=1757485&r1=1757484&r2=1757485&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/net/SecureNioChannel.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/net/SecureNioChannel.java Wed Aug 24 10:24:04 2016 @@ -257,7 +257,12 @@ public class SecureNioChannel extends Ni */ private int processSNI() throws IOException { // Read some data into the network input buffer so we can peek at it. - sc.read(netInBuffer); + int bytesRead = sc.read(netInBuffer); + if (bytesRead == -1) { + // Reached end of stream before SNI could be processed. Treat this + // as if no SNI was present. + return 0; + } TLSClientHelloExtractor extractor = new TLSClientHelloExtractor(netInBuffer); while (extractor.getResult() == ExtractorResult.UNDERFLOW && Modified: tomcat/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1757485&r1=1757484&r2=1757485&view=diff ============================================================================== --- tomcat/trunk/webapps/docs/changelog.xml (original) +++ tomcat/trunk/webapps/docs/changelog.xml Wed Aug 24 10:24:04 2016 @@ -204,6 +204,10 @@ Ensure that <code>Semaphore.release</code> is called in all cases. Even when there is an exception. (violetagg) </fix> + <fix> + <bug>60030</bug>: Correct a potential infinite loop in the SNI parsing + code triggered by failing to handle an end of stream condition. (markt) + </fix> </changelog> </subsection> <subsection name="Jasper"> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org