summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjsing <>2019-04-07 16:35:50 +0000
committerjsing <>2019-04-07 16:35:50 +0000
commita2af4c7dba7453f0994ce278075358a1d3a0e14f (patch)
tree565c05cfc3f5c16bc1e88c8b1cdd28a5323b19c3 /src
parentee8ec972cc5eb7e1ba590f332a6052e9bec80de2 (diff)
downloadopenbsd-a2af4c7dba7453f0994ce278075358a1d3a0e14f.tar.gz
openbsd-a2af4c7dba7453f0994ce278075358a1d3a0e14f.tar.bz2
openbsd-a2af4c7dba7453f0994ce278075358a1d3a0e14f.zip
Revert tasn_prn.c r1.18.
In this code, just because something is cast to a type doesn't mean it is necessarily that type - in this case we cannot check the length of the ASN1_STRING here, since it might be another data type and later handled as an int (for example, in the V_ASN1_BOOLEAN case). We will revisit this post release. ok tb@
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/asn1/tasn_prn.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/lib/libcrypto/asn1/tasn_prn.c b/src/lib/libcrypto/asn1/tasn_prn.c
index 36bb4ddc4b..ab8985318e 100644
--- a/src/lib/libcrypto/asn1/tasn_prn.c
+++ b/src/lib/libcrypto/asn1/tasn_prn.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tasn_prn.c,v 1.19 2019/04/01 15:48:04 jsing Exp $ */ 1/* $OpenBSD: tasn_prn.c,v 1.20 2019/04/07 16:35:50 jsing Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2000. 3 * project 2000.
4 */ 4 */
@@ -512,12 +512,7 @@ asn1_primitive_print(BIO *out, ASN1_VALUE **fld, const ASN1_ITEM *it,
512 512
513 return pf->prim_print(out, fld, it, indent, pctx); 513 return pf->prim_print(out, fld, it, indent, pctx);
514 } 514 }
515
516 str = (ASN1_STRING *)*fld; 515 str = (ASN1_STRING *)*fld;
517
518 if (str->length < 0)
519 return 0;
520
521 if (it->itype == ASN1_ITYPE_MSTRING) 516 if (it->itype == ASN1_ITYPE_MSTRING)
522 utype = str->type & ~V_ASN1_NEG; 517 utype = str->type & ~V_ASN1_NEG;
523 else 518 else
@@ -526,6 +521,7 @@ asn1_primitive_print(BIO *out, ASN1_VALUE **fld, const ASN1_ITEM *it,
526 ASN1_TYPE *atype = (ASN1_TYPE *)*fld; 521 ASN1_TYPE *atype = (ASN1_TYPE *)*fld;
527 utype = atype->type; 522 utype = atype->type;
528 fld = &atype->value.asn1_value; 523 fld = &atype->value.asn1_value;
524 str = (ASN1_STRING *)*fld;
529 if (pctx->flags & ASN1_PCTX_FLAGS_NO_ANY_TYPE) 525 if (pctx->flags & ASN1_PCTX_FLAGS_NO_ANY_TYPE)
530 pname = NULL; 526 pname = NULL;
531 else 527 else