--- a/src/jdk.crypto.ec/share/classes/sun/security/ec/XDHKeyAgreement.java Tue Aug 28 14:55:06 2018 +0200
+++ b/src/jdk.crypto.ec/share/classes/sun/security/ec/XDHKeyAgreement.java Wed Aug 29 12:00:47 2018 -0400
@@ -186,7 +186,7 @@
throw new IllegalStateException("Not initialized correctly");
}
int secretLen = this.secret.length;
- if (offset + secretLen > sharedSecret.length) {
+ if (secretLen > sharedSecret.length - offset) {
throw new ShortBufferException("Need " + secretLen
+ " bytes, only " + (sharedSecret.length - offset)
+ " available");