summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2014-07-12 16:33:26 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2014-07-12 16:33:26 +0000
commit3b41c1b4223016ee21841af23dda30014adc4943 (patch)
tree3adcee3c9d2c4e7c428b3e548d5dc080d975f96c /lib
parent803c8dd8383f2beecc51eeb93a0d74de48fde813 (diff)
Make sure the return value of X509_NAME_oneline(, NULL,) is checked against
NULL. ok deraadt@ guenther@ jsing@
Diffstat (limited to 'lib')
-rw-r--r--lib/libcrypto/asn1/t_crl.c12
-rw-r--r--lib/libcrypto/asn1/t_x509.c6
2 files changed, 13 insertions, 5 deletions
diff --git a/lib/libcrypto/asn1/t_crl.c b/lib/libcrypto/asn1/t_crl.c
index e2f9d8b09ef..67116361a54 100644
--- a/lib/libcrypto/asn1/t_crl.c
+++ b/lib/libcrypto/asn1/t_crl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: t_crl.c,v 1.15 2014/07/11 08:44:47 jsing Exp $ */
+/* $OpenBSD: t_crl.c,v 1.16 2014/07/12 16:33:25 miod Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 1999.
*/
@@ -94,8 +94,11 @@ X509_CRL_print(BIO *out, X509_CRL *x)
l = X509_CRL_get_version(x);
BIO_printf(out, "%8sVersion %lu (0x%lx)\n", "", l + 1, l);
i = OBJ_obj2nid(x->sig_alg->algorithm);
- X509_signature_print(out, x->sig_alg, NULL);
+ if (X509_signature_print(out, x->sig_alg, NULL) == 0)
+ goto err;
p = X509_NAME_oneline(X509_CRL_get_issuer(x), NULL, 0);
+ if (p == NULL)
+ goto err;
BIO_printf(out, "%8sIssuer: %s\n", "", p);
free(p);
BIO_printf(out, "%8sLast Update: ", "");
@@ -127,8 +130,11 @@ X509_CRL_print(BIO *out, X509_CRL *x)
X509V3_extensions_print(out, "CRL entry extensions",
r->extensions, 0, 8);
}
- X509_signature_print(out, x->sig_alg, x->signature);
+ if (X509_signature_print(out, x->sig_alg, x->signature) == 0)
+ goto err;
return 1;
+err:
+ return 0;
}
diff --git a/lib/libcrypto/asn1/t_x509.c b/lib/libcrypto/asn1/t_x509.c
index e6f0692ccc1..f4872d8b245 100644
--- a/lib/libcrypto/asn1/t_x509.c
+++ b/lib/libcrypto/asn1/t_x509.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: t_x509.c,v 1.24 2014/07/11 08:44:47 jsing Exp $ */
+/* $OpenBSD: t_x509.c,v 1.25 2014/07/12 16:33:25 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -505,7 +505,9 @@ X509_NAME_print(BIO *bp, X509_NAME *name, int obase)
l = 80 - 2 - obase;
b = X509_NAME_oneline(name, NULL, 0);
- if (!*b) {
+ if (b == NULL)
+ return 0;
+ if (*b == '\0') {
free(b);
return 1;
}