diff options
-rw-r--r-- | crypto/src/asn1/DefiniteLengthInputStream.cs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/crypto/src/asn1/DefiniteLengthInputStream.cs b/crypto/src/asn1/DefiniteLengthInputStream.cs index d10ea4d12..e3b9b5737 100644 --- a/crypto/src/asn1/DefiniteLengthInputStream.cs +++ b/crypto/src/asn1/DefiniteLengthInputStream.cs @@ -16,16 +16,16 @@ namespace Org.BouncyCastle.Asn1 internal DefiniteLengthInputStream(Stream inStream, int length, int limit) : base(inStream, limit) { - if (length < 0) - throw new ArgumentException("negative lengths not allowed", "length"); + if (length <= 0) + { + if (length < 0) + throw new ArgumentException("negative lengths not allowed", "length"); - this._originalLength = length; - this._remaining = length; + SetParentEofDetect(true); + } - if (length == 0) - { - SetParentEofDetect(true); - } + this._originalLength = length; + this._remaining = length; } internal int Remaining |