summary refs log tree commit diff
path: root/crypto/src
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2017-08-31 17:38:16 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2017-08-31 17:38:16 +0700
commit16cb1559e6c7ef565d9d44a20b82d2e5f39dbd5b (patch)
tree69c3f1554a74a524178fbbc8dcaaa5b7f1e1f3f8 /crypto/src
parentFix the message in case of test failure (diff)
downloadBouncyCastle.NET-ed25519-16cb1559e6c7ef565d9d44a20b82d2e5f39dbd5b.tar.xz
Avoid integer overflow in argument checks
- see https://github.com/bcgit/bc-csharp/issues/91
Diffstat (limited to 'crypto/src')
-rw-r--r--crypto/src/crypto/parameters/KeyParameter.cs2
1 files changed, 1 insertions, 1 deletions
diff --git a/crypto/src/crypto/parameters/KeyParameter.cs b/crypto/src/crypto/parameters/KeyParameter.cs
index 33dff96d7..043adf276 100644
--- a/crypto/src/crypto/parameters/KeyParameter.cs
+++ b/crypto/src/crypto/parameters/KeyParameter.cs
@@ -27,7 +27,7 @@ namespace Org.BouncyCastle.Crypto.Parameters
 				throw new ArgumentNullException("key");
 			if (keyOff < 0 || keyOff > key.Length)
 				throw new ArgumentOutOfRangeException("keyOff");
-			if (keyLen < 0 || (keyOff + keyLen) > key.Length)
+            if (keyLen < 0 || keyLen > (key.Length - keyOff))
 				throw new ArgumentOutOfRangeException("keyLen");
 
 			this.key = new byte[keyLen];