Print <ABSENT> if a STACK is NULL.
authorDr. Stephen Henson <steve@openssl.org>
Wed, 28 Sep 2016 14:18:58 +0000 (15:18 +0100)
committerDr. Stephen Henson <steve@openssl.org>
Thu, 29 Sep 2016 15:21:46 +0000 (16:21 +0100)
If a STACK (corresponding to SEQUENCE OF or SET OF) is NULL then the
field is absent as opposed to empty (present but has zero elements).

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

index f53e9056aa90afbb36773b9c850f2ea92d1bf70b..b5698060e8defee66d1b48fe2e27280a7f7baac6 100644 (file)
@@ -315,7 +315,8 @@ static int asn1_template_print_ctx(BIO *out, ASN1_VALUE **fld, int indent,
                                      pctx))
                 return 0;
         }
-        if (!i && BIO_printf(out, "%*s<EMPTY>\n", indent + 2, "") <= 0)
+        if (i == 0 && BIO_printf(out, "%*s<%s>\n", indent + 2, "",
+                                 stack == NULL ? "ABSENT" : "EMPTY") <= 0)
             return 0;
         if (pctx->flags & ASN1_PCTX_FLAGS_SHOW_SEQUENCE) {
             if (BIO_printf(out, "%*s}\n", indent, "") <= 0)