summaryrefslogtreecommitdiff
path: root/lib/libcrypto/asn1
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2015-02-14 15:15:28 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2015-02-14 15:15:28 +0000
commitc7377fb40d0e535dbbf0a5cb197bf00bcc185728 (patch)
tree8a250b597d092a489298980d768fc67d3439bb46 /lib/libcrypto/asn1
parentd38fa476a43b2a602615c3d1ad9f861ecdb0062c (diff)
Possible NULL pointer dereferences. Coverity CID 21719, 21732.
ok doug@ jsing@
Diffstat (limited to 'lib/libcrypto/asn1')
-rw-r--r--lib/libcrypto/asn1/tasn_new.c5
-rw-r--r--lib/libcrypto/asn1/tasn_prn.c5
2 files changed, 7 insertions, 3 deletions
diff --git a/lib/libcrypto/asn1/tasn_new.c b/lib/libcrypto/asn1/tasn_new.c
index cbc6bfc1d59..86b2b3facdf 100644
--- a/lib/libcrypto/asn1/tasn_new.c
+++ b/lib/libcrypto/asn1/tasn_new.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tasn_new.c,v 1.12 2015/02/14 13:32:46 jsing Exp $ */
+/* $OpenBSD: tasn_new.c,v 1.13 2015/02/14 15:15:27 miod Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2000.
*/
@@ -351,7 +351,8 @@ ASN1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it)
default:
str = ASN1_STRING_type_new(utype);
- if (it->itype == ASN1_ITYPE_MSTRING && str)
+ if (it != NULL && it->itype == ASN1_ITYPE_MSTRING &&
+ str != NULL)
str->flags |= ASN1_STRING_FLAG_MSTRING;
*pval = (ASN1_VALUE *)str;
break;
diff --git a/lib/libcrypto/asn1/tasn_prn.c b/lib/libcrypto/asn1/tasn_prn.c
index 844960fc776..c9fde96789f 100644
--- a/lib/libcrypto/asn1/tasn_prn.c
+++ b/lib/libcrypto/asn1/tasn_prn.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tasn_prn.c,v 1.12 2015/02/07 13:19:15 doug Exp $ */
+/* $OpenBSD: tasn_prn.c,v 1.13 2015/02/14 15:15:27 miod Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2000.
*/
@@ -301,7 +301,10 @@ asn1_item_print_ctx(BIO *out, ASN1_VALUE **fld, int indent, const ASN1_ITEM *it,
/* Print each field entry */
for (i = 0, tt = it->templates; i < it->tcount; i++, tt++) {
const ASN1_TEMPLATE *seqtt;
+
seqtt = asn1_do_adb(fld, tt, 1);
+ if (seqtt == NULL)
+ return 0;
tmpfld = asn1_get_field_ptr(fld, seqtt);
if (!asn1_template_print_ctx(out, tmpfld, indent + 2,
seqtt, pctx))