1 files changed, 2 insertions, 2 deletions
diff --git a/crypto/src/crypto/Check.cs b/crypto/src/crypto/Check.cs
index 96a05c64b..aacda144f 100644
--- a/crypto/src/crypto/Check.cs
+++ b/crypto/src/crypto/Check.cs
@@ -12,13 +12,13 @@ namespace Org.BouncyCastle.Crypto
internal static void DataLength(byte[] buf, int off, int len, string msg)
{
- if (off + len > buf.Length)
+ if (off > (buf.Length - len))
throw new DataLengthException(msg);
}
internal static void OutputLength(byte[] buf, int off, int len, string msg)
{
- if (off + len > buf.Length)
+ if (off > (buf.Length - len))
throw new OutputLengthException(msg);
}
}
|