summary refs log tree commit diff
path: root/crypto/src/asn1/Asn1InputStream.cs
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2024-03-12 00:23:12 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2024-03-12 00:23:12 +0700
commit70c34c9bcef9ba27aefb93dbdb70bbe843c8452e (patch)
treeaa065ddffa4ada5a659712126215d7e7fd8c4f10 /crypto/src/asn1/Asn1InputStream.cs
parentAdd Asn1RelativeOid cache (diff)
downloadBouncyCastle.NET-ed25519-70c34c9bcef9ba27aefb93dbdb70bbe843c8452e.tar.xz
ASN.1: Limit OID contents to 4096 bytes
Diffstat (limited to 'crypto/src/asn1/Asn1InputStream.cs')
-rw-r--r--crypto/src/asn1/Asn1InputStream.cs2
1 files changed, 2 insertions, 0 deletions
diff --git a/crypto/src/asn1/Asn1InputStream.cs b/crypto/src/asn1/Asn1InputStream.cs
index a1bc987cc..3b5eaaa95 100644
--- a/crypto/src/asn1/Asn1InputStream.cs
+++ b/crypto/src/asn1/Asn1InputStream.cs
@@ -392,11 +392,13 @@ namespace Org.BouncyCastle.Asn1
             }
             case Asn1Tags.ObjectIdentifier:
             {
+                DerObjectIdentifier.CheckContentsLength(defIn.Remaining);
                 bool usedBuffer = GetBuffer(defIn, tmpBuffers, out var contents);
                 return DerObjectIdentifier.CreatePrimitive(contents, clone: usedBuffer);
             }
             case Asn1Tags.RelativeOid:
             {
+                Asn1RelativeOid.CheckContentsLength(defIn.Remaining);
                 bool usedBuffer = GetBuffer(defIn, tmpBuffers, out var contents);
                 return Asn1RelativeOid.CreatePrimitive(contents, clone: usedBuffer);
             }