From a9c6667cabf14f2b94196b886e9884961d18b7da Mon Sep 17 00:00:00 2001 From: David Benjamin Date: Wed, 18 Mar 2015 19:57:36 -0400 Subject: [PATCH] Fix asn1_item_print_ctx The call to asn1_do_adb can return NULL on error, so we should check the return value before attempting to use it. (Imported from upstream's 34a7ed0c39aa3ab67eea1e106577525eaf0d7a00.) Change-Id: Ia43cdc73b5f1d16e6fc907b5aaf13c9df5a9958c Reviewed-on: https://boringssl-review.googlesource.com/4007 Reviewed-by: Adam Langley --- crypto/asn1/tasn_prn.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crypto/asn1/tasn_prn.c b/crypto/asn1/tasn_prn.c index 4eb522db..6684cdfc 100644 --- a/crypto/asn1/tasn_prn.c +++ b/crypto/asn1/tasn_prn.c @@ -309,6 +309,8 @@ static int asn1_item_print_ctx(BIO *out, ASN1_VALUE **fld, int indent, { const ASN1_TEMPLATE *seqtt; seqtt = asn1_do_adb(fld, tt, 1); + if (!seqtt) + return 0; tmpfld = asn1_get_field_ptr(fld, seqtt); if (!asn1_template_print_ctx(out, tmpfld, indent + 2, seqtt, pctx))