Fix asn1_item_print_ctx
authorMatt Caswell <matt@openssl.org>
Wed, 11 Mar 2015 19:41:01 +0000 (19:41 +0000)
committerMatt Caswell <matt@openssl.org>
Thu, 12 Mar 2015 09:22:19 +0000 (09:22 +0000)
The call to asn1_do_adb can return NULL on error, so we should check the
return value before attempting to use it.

Reviewed-by: Rich Salz <rsalz@openssl.org>
crypto/asn1/tasn_prn.c

index 94e220be6953f6c4571cea1f87b4d9653b171385..2626de9728e74dda0b3fd1e1d567ebdb4bdf8eca 100644 (file)
@@ -285,6 +285,8 @@ static int asn1_item_print_ctx(BIO *out, ASN1_VALUE **fld, int indent,
         for (i = 0, tt = it->templates; i < it->tcount; i++, tt++) {
             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))