src/java.base/share/classes/sun/security/ssl/ServerHello.java
changeset 51574 ed52ea83f830
parent 50768 68fa3d4026ea
child 53055 c36464ea1f04
--- a/src/java.base/share/classes/sun/security/ssl/ServerHello.java	Tue Aug 21 13:44:59 2018 +0100
+++ b/src/java.base/share/classes/sun/security/ssl/ServerHello.java	Tue Aug 21 11:30:48 2018 -0700
@@ -40,6 +40,7 @@
 import javax.crypto.spec.IvParameterSpec;
 import javax.net.ssl.SSLException;
 import javax.net.ssl.SSLHandshakeException;
+import javax.net.ssl.SSLProtocolException;
 import sun.security.ssl.CipherSuite.KeyExchange;
 import sun.security.ssl.ClientHello.ClientHelloMessage;
 import sun.security.ssl.SSLCipher.SSLReadCipher;
@@ -139,8 +140,11 @@
 
             this.serverRandom = new RandomCookie(m);
             this.sessionId = new SessionId(Record.getBytes8(m));
-            sessionId.checkLength(serverVersion.id);
-
+            try {
+                sessionId.checkLength(serverVersion.id);
+            } catch (SSLProtocolException ex) {
+                handshakeContext.conContext.fatal(Alert.ILLEGAL_PARAMETER, ex);
+            }
 
             int cipherSuiteId = Record.getInt16(m);
             this.cipherSuite = CipherSuite.valueOf(cipherSuiteId);