src/jdk.crypto.ec/share/classes/sun/security/ec/XDHKeyAgreement.java
changeset 51569 46ec360a7014
parent 51086 57c152eb3198
child 55353 946f7f2d321c
child 56880 6ba2f471478b
--- 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");