summaryrefslogtreecommitdiffstats
path: root/crypto/asn1
diff options
context:
space:
mode:
authorDr. David von Oheimb <David.von.Oheimb@siemens.com>2021-06-14 12:58:40 +0200
committerDr. David von Oheimb <dev@ddvo.net>2021-06-15 14:23:29 +0200
commit515480be79de6907fcf0f7797aa0d3cd45e7d33c (patch)
treef1385d8936c1539d224c485f2b6463c01d818130 /crypto/asn1
parentbb19b9d4561228599b2259f6a4912066274ae622 (diff)
ASN1_parse_dump(): allow NULL BIO input, to simplify applications not needing output
Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15722)
Diffstat (limited to 'crypto/asn1')
-rw-r--r--crypto/asn1/asn1_parse.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/crypto/asn1/asn1_parse.c b/crypto/asn1/asn1_parse.c
index 83ac535cc3..a131713d73 100644
--- a/crypto/asn1/asn1_parse.c
+++ b/crypto/asn1/asn1_parse.c
@@ -41,15 +41,16 @@ static int asn1_print_info(BIO *bp, long offset, int depth, int hl, long len,
offset, depth, (long)hl, p) <= 0)
goto err;
}
- if (BIO_set_prefix(bp, str) <= 0) {
- if ((bp = BIO_push(BIO_new(BIO_f_prefix()), bp)) == NULL)
+ if (bp != NULL) {
+ if (BIO_set_prefix(bp, str) <= 0) {
+ if ((bp = BIO_push(BIO_new(BIO_f_prefix()), bp)) == NULL)
+ goto err;
+ pop_f_prefix = 1;
+ }
+ saved_indent = BIO_get_indent(bp);
+ if (BIO_set_prefix(bp, str) <= 0 || BIO_set_indent(bp, indent) < 0)
goto err;
- pop_f_prefix = 1;
}
- saved_indent = BIO_get_indent(bp);
- if (BIO_set_prefix(bp, str) <= 0
- || BIO_set_indent(bp, indent) < 0)
- goto err;
/*
* BIO_set_prefix made a copy of |str|, so we can safely use it for