Limit depth of ASN1 parse printing.
Thanks to Guido Vranken <guidovranken@gmail.com> for reporting this issue. Reviewed-by: Tim Hudson <tjh@openssl.org> (cherry picked from commit 158e5207a794603f5d64ffa95e0247c7808ab445) Conflicts: crypto/asn1/asn1_par.c
This commit is contained in:
parent
88883f2ebf
commit
5844c9453f
@ -62,6 +62,10 @@
|
|||||||
#include <openssl/objects.h>
|
#include <openssl/objects.h>
|
||||||
#include <openssl/asn1.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,
|
static int asn1_print_info(BIO *bp, int tag, int xclass, int constructed,
|
||||||
int indent);
|
int indent);
|
||||||
static int asn1_parse2(BIO *bp, const unsigned char **pp, long length,
|
static int asn1_parse2(BIO *bp, const unsigned char **pp, long length,
|
||||||
@ -128,6 +132,12 @@ static int asn1_parse2(BIO *bp, const unsigned char **pp, long length,
|
|||||||
#else
|
#else
|
||||||
dump_indent = 6; /* Because we know BIO_dump_indent() */
|
dump_indent = 6; /* Because we know BIO_dump_indent() */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (depth > ASN1_PARSE_MAXDEPTH) {
|
||||||
|
BIO_puts(bp, "BAD RECURSION DEPTH\n");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
p = *pp;
|
p = *pp;
|
||||||
tot = p + length;
|
tot = p + length;
|
||||||
op = p - 1;
|
op = p - 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user