aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/asn1/asn1_par.c
diff options
context:
space:
mode:
authorJung-uk Kim <jkim@FreeBSD.org>2015-12-03 17:25:26 +0000
committerJung-uk Kim <jkim@FreeBSD.org>2015-12-03 17:25:26 +0000
commit145e3a85931a836f8dccec73e02594f7255abcfd (patch)
tree03b95bb4075b5bfadd5b0dabf3c4233035d6b774 /crypto/asn1/asn1_par.c
parentd7a2d00e5375699d95f3720a7b779ded3c805b5f (diff)
downloadsrc-vendor/openssl-0.9.8.tar.gz
src-vendor/openssl-0.9.8.zip
Notes
Notes: svn path=/vendor-crypto/openssl/dist-0.9.8/; revision=291711 svn path=/vendor-crypto/openssl/0.9.8zh/; revision=291712; tag=vendor/openssl/0.9.8zh
Diffstat (limited to 'crypto/asn1/asn1_par.c')
-rw-r--r--crypto/asn1/asn1_par.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/crypto/asn1/asn1_par.c b/crypto/asn1/asn1_par.c
index e15e341ad8d2..e16483dea57f 100644
--- a/crypto/asn1/asn1_par.c
+++ b/crypto/asn1/asn1_par.c
@@ -62,6 +62,10 @@
#include <openssl/objects.h>
#include <openssl/asn1.h>
+#ifndef ASN1_PARSE_MAXDEPTH
+#define ASN1_PARSE_MAXDEPTH 128
+#endif
+
static int asn1_print_info(BIO *bp, int tag, int xclass, int constructed,
int indent);
static int asn1_parse2(BIO *bp, const unsigned char **pp, long length,
@@ -134,6 +138,12 @@ static int asn1_parse2(BIO *bp, const unsigned char **pp, long length,
#else
dump_indent = 6; /* Because we know BIO_dump_indent() */
#endif
+
+ if (depth > ASN1_PARSE_MAXDEPTH) {
+ BIO_puts(bp, "BAD RECURSION DEPTH\n");
+ return 0;
+ }
+
p = *pp;
tot = p + length;
op = p - 1;