summary refs log tree commit diff
path: root/crypto/src/asn1/ConstructedBitStream.cs
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/asn1/ConstructedBitStream.cs')
-rw-r--r--crypto/src/asn1/ConstructedBitStream.cs10
1 files changed, 6 insertions, 4 deletions
diff --git a/crypto/src/asn1/ConstructedBitStream.cs b/crypto/src/asn1/ConstructedBitStream.cs

index 7c9e7c9e4..49f54fc1b 100644 --- a/crypto/src/asn1/ConstructedBitStream.cs +++ b/crypto/src/asn1/ConstructedBitStream.cs
@@ -29,9 +29,11 @@ namespace Org.BouncyCastle.Asn1 get { return m_padBits; } } - public override int Read(byte[] buf, int off, int len) + public override int Read(byte[] buffer, int offset, int count) { - if (len < 1) + Streams.ValidateBufferArguments(buffer, offset, count); + + if (count < 1) return 0; if (m_currentStream == null) @@ -51,13 +53,13 @@ namespace Org.BouncyCastle.Asn1 for (;;) { - int numRead = m_currentStream.Read(buf, off + totalRead, len - totalRead); + int numRead = m_currentStream.Read(buffer, offset + totalRead, count - totalRead); if (numRead > 0) { totalRead += numRead; - if (totalRead == len) + if (totalRead == count) return totalRead; } else