--- a/src/java.base/share/classes/sun/security/ssl/NewSessionTicket.java Wed May 16 22:13:16 2018 -0700
+++ b/src/java.base/share/classes/sun/security/ssl/NewSessionTicket.java Thu May 17 09:00:47 2018 -0700
@@ -106,8 +106,13 @@
@Override
public int messageLength() {
- return 8 + ticketNonce.length + 1 + ticket.length
- + 2 + extensions.length();
+ int extLen = extensions.length();
+ if (extLen == 0) {
+ extLen = 2; // empty extensions
+ }
+
+ return 8 + ticketNonce.length + 1 +
+ ticket.length + 2 + extLen;
}
@Override
@@ -116,7 +121,13 @@
hos.putInt32(ticketAgeAdd);
hos.putBytes8(ticketNonce);
hos.putBytes16(ticket);
- extensions.send(hos);
+
+ // Is it an empty extensions?
+ if (extensions.length() == 0) {
+ hos.putInt16(0);
+ } else {
+ extensions.send(hos);
+ }
}
@Override