From 80a82486157077bf62ba51bbcd4f7891ae7b6a21 Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Sun, 21 Nov 2021 22:22:16 +0700 Subject: Fix return values --- crypto/src/asn1/ConstructedOctetStream.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'crypto/src/asn1/ConstructedOctetStream.cs') diff --git a/crypto/src/asn1/ConstructedOctetStream.cs b/crypto/src/asn1/ConstructedOctetStream.cs index 829a9a427..63d7d9d94 100644 --- a/crypto/src/asn1/ConstructedOctetStream.cs +++ b/crypto/src/asn1/ConstructedOctetStream.cs @@ -21,6 +21,9 @@ namespace Org.BouncyCastle.Asn1 public override int Read(byte[] buffer, int offset, int count) { + if (count < 1) + return 0; + if (_currentStream == null) { if (!_first) @@ -66,11 +69,11 @@ namespace Org.BouncyCastle.Asn1 if (_currentStream == null) { if (!_first) - return 0; + return -1; Asn1OctetStringParser next = GetNextParser(); if (next == null) - return 0; + return -1; _first = false; _currentStream = next.GetOctetStream(); -- cgit 1.4.1