diff options
Diffstat (limited to 'src/crypto/asn1/asn1_par.c')
-rw-r--r-- | src/crypto/asn1/asn1_par.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/crypto/asn1/asn1_par.c b/src/crypto/asn1/asn1_par.c index aff3e2b..e04aa1e 100644 --- a/src/crypto/asn1/asn1_par.c +++ b/src/crypto/asn1/asn1_par.c @@ -61,6 +61,8 @@ #include <openssl/mem.h> +#define ASN1_PARSE_MAXDEPTH 128 + 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, @@ -125,6 +127,13 @@ static int asn1_parse2(BIO *bp, const unsigned char **pp, long length, int offse #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; |